When I run tobyink's benchmark under 5.18, I get a 20% reduction in runtime:
C:\test>\perl5.18\bin\perl.exe use strict; use warnings; use Benchmark qw(cmpthese); my $name = 'foo'; my $path = 'foobar'; my $sub1 = sub { $_[0]{$path}{$name} = $_[1] if @_ == 2; $_[0]{$path}{ +$name} }; my $sub2 = eval qq[ sub { \$_[0]{$path}{$name} = \$_[1] if \@_ == 2; \ +$_[0]{$path}{$name} } ] or die($@); my $self = {}; cmpthese -1, { closure => sub { $self->$sub1(0); $self->$sub1( $self->$sub1 + $_ ) for 0..10_000; }, stringy => sub { $self->$sub2(0); $self->$sub2( $self->$sub2 + $_ ) for 0..10_000; }, }; ^Z Rate closure stringy closure 65.7/s -- -17% stringy 79.1/s 20% --
If you got a 20% rise, you'd consider it "significant".
If you were offered a 20% reduction in the cost of your next car, you'd consider it "significant".
If you were offered a 20% reduction in your likelihood of early mortality, you'd consider it "significant".
If you were gifted a 20% reduction in your daily processing, such that it reduced it from 25 hours to 20, you'd consider it "significant".
Stop being an ass.
In reply to Re^6: Creating flexible method accessor (noticeable)
by BrowserUk
in thread Creating flexible method accessor
by puterboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |