I'd like to see any Benchmark that could show that using that technique you describe could provide measurable performance gains.
#! perl -w use strict; use Benchmark qw(cmpthese); sub parent { return ++$_[$#_]; # minimal use of entire passed array. } sub child1 { my ($self, @rest) = @_; return parent(@rest); } sub child2 { my $self = shift; goto &parent; } print 'child1: ', child1( "fred", 1..1000 ), $/; print 'child2: ', child2( "bill", 1..1000 ), $/; cmpthese( 10000, { noShiftOrGoto => sub { child1( "fred", 1..1000 ); }, shiftAndGoto => sub { child2( "bill", 1..1000 ); }, }); __DATA__ C:\test>196823 child1: 1001 child2: 1001 Benchmark: timing 10000 iterations of noShiftOrGoto, shiftAndGoto... noShiftOrGoto: 33 wallclock secs (32.33 usr + 0.00 sys = 32.33 CPU) @ + 309.35/s (n=10000) shiftAndGoto: 6 wallclock secs ( 5.85 usr + 0.00 sys = 5.85 CPU) @ +1709.69/s (n=10000) Rate noShiftOrGoto shiftAndGoto noShiftOrGoto 309/s -- -82% shiftAndGoto 1710/s 453% -- C:\test>
In reply to Re: Re^8: How about 450% greater performance
by BrowserUk
in thread stoping and restarting a loop
by mnlight
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |