Front page | perl.perl5.porters |
Postings from September 2010
Re: All gone
Thread Previous
From:
Steffen Mueller
Date:
September 16, 2010 13:21
Subject:
Re: All gone
Message ID:
4C927C49.4080400@cpan.org
Steffen Mueller wrote:
> Next step would be a lower level profiler OR someone with better
> insight. Not me.
Oh, I forgot to explore one avenue that's open to me. Benchmark the
commit right before and right after the change. I've remedied that.
Since I'm certain that hateful mail software will wrap my lines, the
result is also posted here: http://paste.scsys.co.uk/50918
Cheers,
Steffen
PS: explanation of the method now at
http://blogs.perl.org/users/steffen_mueller/2010/09/your-benchmarks-suck.html
The eight+eight benchmarks below explore three dimensions:
- before vs after
- s/// vs .=
- package $a vs state $a
Summary
=======
FIRST RUN | SECOND RUN
- s/// && package $a
before 2.1161e+00 +/- 2.4e-03 | 2.1281e+00 +/- 4.1e-03
after 2.2138e+00 +/- 3.7e-03 | 2.2130e+00 +/- 3.4e-03
- s/// && state $a
before 2.2411e+00 +/- 3.8e-03 | 2.2470e+00 +/- 3.9e-03
after 2.3219e+00 +/- 2.5e-03 | 2.3291e+00 +/- 4.3e-03
- .= && package $a
before 1.8331e+00 +/- 2.5e-03 | 1.8397e+00 +/- 3.8e-03
after 1.8621e+00 +/- 3.0e-03 | 1.8617e+00 +/- 3.8e-03
- .= && state $a
before 1.9580e+00 +/- 3.0e-03 | 1.9637e+00 +/- 3.0e-03
after 1.9801e+00 +/- 3.5e-03 | 1.9913e+00 +/- 3.6e-03
Observations
============
1) package var is faster than state. The offset doesn't seem to depend
on the commit. I.e. doesn't matter.
2) s/// is much more strongly affected by the commit than string
concatenation.
3) Of course, .= is also generally faster than s///. Again. Doesn't matter.
First Run
=========
--[before-string-change]-->
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a=~s/$/../;$n<2
and return$n;f($n-1)+f($n-2)}f(31)
Ran 75 iterations of the command.
Rejected 5 samples as outliers.
Rounded run time per iteration: 2.1161e+00 +/- 2.4e-03 (0.1%)
sub f{use 5.12.0;state $a;my($n)=@_;$n==8 and bless{1..4} and
$a=~s/$/../;$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 70 iterations of the command.
Rejected 0 samples as outliers.
Rounded run time per iteration: 2.2411e+00 +/- 3.8e-03 (0.2%)
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a .= '..';$n<2 and
return$n;f($n-1)+f($n-2)}f(31)
Ran 72 iterations of the command.
Rejected 1 samples as outliers.
Rounded run time per iteration: 1.8331e+00 +/- 2.5e-03 (0.1%)
sub f{use 5.12.0;state $a; my($n)=@_;$n==8 and bless{1..4} and
$a.='..';$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 74 iterations of the command.
Rejected 4 samples as outliers.
Rounded run time per iteration: 1.9580e+00 +/- 3.0e-03 (0.2%)
--[after-string-change]-->
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a=~s/$/../;$n<2
and return$n;f($n-1)+f($n-2)}f(31)
Ran 70 iterations of the command.
Rejected 0 samples as outliers.
Rounded run time per iteration: 2.2138e+00 +/- 3.7e-03 (0.2%)
sub f{use 5.12.0;state $a;my($n)=@_;$n==8 and bless{1..4} and
$a=~s/$/../;$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 75 iterations of the command.
Rejected 5 samples as outliers.
Rounded run time per iteration: 2.3219e+00 +/- 2.5e-03 (0.1%)
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a .= '..';$n<2 and
return$n;f($n-1)+f($n-2)}f(31)
Ran 75 iterations of the command.
Rejected 5 samples as outliers.
Rounded run time per iteration: 1.8621e+00 +/- 3.0e-03 (0.2%)
sub f{use 5.12.0;state $a; my($n)=@_;$n==8 and bless{1..4} and
$a.='..';$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 74 iterations of the command.
Rejected 4 samples as outliers.
Rounded run time per iteration: 1.9801e+00 +/- 3.5e-03 (0.2%)
Second run
==========
--[before-string-change]-->
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a=~s/$/../;$n<2
and return$n;f($n-1)+f($n-2)}f(31)
Ran 74 iterations of the command.
Rejected 4 samples as outliers.
Rounded run time per iteration: 2.1281e+00 +/- 4.1e-03 (0.2%)
sub f{use 5.12.0;state $a;my($n)=@_;$n==8 and bless{1..4} and
$a=~s/$/../;$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 70 iterations of the command.
Rejected 0 samples as outliers.
Rounded run time per iteration: 2.2470e+00 +/- 3.9e-03 (0.2%)
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a .= '..';$n<2 and
return$n;f($n-1)+f($n-2)}f(31)
Ran 73 iterations of the command.
Rejected 3 samples as outliers.
Rounded run time per iteration: 1.8397e+00 +/- 3.8e-03 (0.2%)
sub f{use 5.12.0;state $a; my($n)=@_;$n==8 and bless{1..4} and
$a.='..';$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 74 iterations of the command.
Rejected 4 samples as outliers.
Rounded run time per iteration: 1.9637e+00 +/- 3.0e-03 (0.2%)
--[after-string-change]-->
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a=~s/$/../;$n<2
and return$n;f($n-1)+f($n-2)}f(31)
Ran 74 iterations of the command.
Rejected 4 samples as outliers.
Rounded run time per iteration: 2.2130e+00 +/- 3.4e-03 (0.2%)
sub f{use 5.12.0;state $a;my($n)=@_;$n==8 and bless{1..4} and
$a=~s/$/../;$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 74 iterations of the command.
Rejected 4 samples as outliers.
Rounded run time per iteration: 2.3291e+00 +/- 4.3e-03 (0.2%)
sub f{use 5.12.0;my($n)=@_;$n==8 and bless{1..4} and $a .= '..';$n<2 and
return$n;f($n-1)+f($n-2)}f(31)
Ran 73 iterations of the command.
Rejected 3 samples as outliers.
Rounded run time per iteration: 1.8617e+00 +/- 3.8e-03 (0.2%)
sub f{use 5.12.0;state $a; my($n)=@_;$n==8 and bless{1..4} and
$a.='..';$n<2 and return$n;f($n-1)+f($n-2)}f(31)
Ran 75 iterations of the command.
Rejected 5 samples as outliers.
Rounded run time per iteration: 1.9913e+00 +/- 3.6e-03 (0.2%)
Thread Previous