Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
my $delay = shift // 2;
my $old = 'none';
while (1) {
commit eb3397a3fae7d5692bbc3766c05b7c4a8ecf6a0a
Author: David Golden <dagolden@cpan.org>
Date: Mon Apr 14 23:50:32 2014 -0400
cache objects by path except for tempfile/tempdir
diff --git a/lib/Path/Tiny.pm b/lib/Path/Tiny.pm
index 9660448..42385c7 100644
--- a/lib/Path/Tiny.pm
+++ b/lib/Path/Tiny.pm
BENCHMARKING foo-small
Rate Path::Tiny File::Slurp fast slurp
Path::Tiny 34133/s -- -10% -45%
File::Slurp 37959/s 11% -- -39%
fast slurp 61793/s 81% 63% --
BENCHMARKING foo-med
Rate Path::Tiny File::Slurp fast slurp
Path::Tiny 10778/s -- -5% -16%
File::Slurp 11395/s 6% -- -11%
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use Benchmark qw( cmpthese );
use Path::Tiny;
use File::Slurp qw/read_file/;
sub fast_slurp {
# .profile is sourced by shells after /etc/profile
# Flag to avoid recursion from bashrc
export DID_PROFILE=1
# Functions to help us manage paths. Second argument is the name of the
# path variable to be modified (default: PATH)
pathremove () {
local IFS=':'
local NEWPATH
# .bashrc
# For login shells, .bash_profile will source this file.
# For interactive non-login shells, bash sources this file directly
# For non-interactive shells, bash should source this file
# if it detects that it's running over the network (e.g. ssh)
# If this .bashrc is running but we're not interactive, we might be
# a non-interactive shell run with with --login or we might be
. ~/perl5/perlbrew/etc/bashrc
. ~/perl5/perlbrew/etc/perlbrew-completion.bash
__perlbrew_ps1() {
local printf_format="${1:-(%s)}"
local current=$(perlbrew list | grep \* | sed -e 's/\* //' )
printf -- "$printf_format" "$current"
}
$ up 20.0
Current perl is 20.0@std
$ time perl -wE 'system("perlver lib") for 1..10' > /dev/null
real 0m32.946s
user 0m32.667s
sys 0m0.222s
$ time perl -wE 'system("perlver lib") for 1..10' > /dev/null
$ up 20.0
Current perl is 20.0@std
$ time dzil build > /dev/null
real 0m10.759s
user 0m10.369s
sys 0m0.337s
$ time dzil build > /dev/null
use 5.008001;
use strict;
use warnings;
package YAML;
sub Dump { YAML->new(backend => 'Old')->dump(@_) }
sub Load { ... } # delegate to YAML::Old
sub new {