Skip to content

Instantly share code, notes, and snippets.

@rurban
Last active April 11, 2016 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rurban/0ab592fd1967da9fb2ab51c1be5ffae5 to your computer and use it in GitHub Desktop.
Save rurban/0ab592fd1967da9fb2ab51c1be5ffae5 to your computer and use it in GitHub Desktop.
$ for p in `cat benchperl.lst`; do perf stat -r3 $p bench.pl 2>> bench.dat; done
bench.pl: (no unicode, no oo)
#!/usr/bin/perl
my @a = (0..31);
my %h = (1..100);
my $s = '0123456789';
sub f {
my $n = shift;
$n % 2 and bless{1..4} and $h{$n} and $a[$n] and $s =~ s/$/../;
$n<2 and return $n;
f($n-1)+f($n-2)
}
f(27)
----
time perf
5.24 13.952 14.122639244 +-0.16%
5.22cs 14.284 10.993249848 +-0.48% (cperl with signatures)
5.22c 14.604 14.185113826 +-0.23% (cperl)
5.22 14.395 14.204612476 +-0.22%
5.20 14.615 14.214084151 +-0.23%
5.18 13.908 13.529222182 +-0.12%
5.16 14.110 13.766742025 +-0.17%
5.14 14.011 13.773219445 +-0.05%
5.12 12.921 12.393115148 +-0.32%
5.10 11.694 12.214294100 +-0.26%
5.8.9 12.276 12.054642953 +-0.06%
5.8.5 12.469 12.212471282 +-0.22%
5.6.2 12.877 12.626332659 +-0.38%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment