Re: [Perlunit-devel] commits
Status: Beta
Brought to you by:
mca1001
From: Ian R. <ia...@ez...> - 2001-11-12 14:42:48
|
>>>>> " AS" == Adam Spiers <ad...@sp...> writes: AS> Ian Robertson (ia...@ez...) wrote: IBR> FWIW, on my box, the shift method seems to be a touch faster if there IBR> are one or two arguments (including $self); the @_ method starts to IBR> win at three. However, the difference is in the fraction of a IBR> microsecond range, so it's probably not a deciding factor :). AS> That's odd, my tests show that the more shifts you use, the slower it AS> gets. Try the attached benchmark. It may be something to do with a AS> difference in Perl versions, of course. Mine's 5.6.0. That's the same experience I had - for two arguments or less (including $self), using shift is faster; after that, @_ is faster. Running 5.005_03 (and changing cmpthese to timethese for my (presumably older) version of Benchmark), I get these results: Benchmark: timing 500000 iterations of two_all, two_none, two_one... two_all: 4 wallclock secs ( 2.79 usr + 0.00 sys = 2.79 CPU) two_none: 3 wallclock secs ( 2.82 usr + 0.00 sys = 2.82 CPU) two_one: 2 wallclock secs ( 3.05 usr + 0.00 sys = 3.05 CPU) Benchmark: timing 500000 iterations of three_all, three_none, three_one... three_all: 2 wallclock secs ( 3.29 usr + 0.00 sys = 3.29 CPU) three_none: 2 wallclock secs ( 3.03 usr + 0.00 sys = 3.03 CPU) three_one: 3 wallclock secs ( 3.38 usr + 0.00 sys = 3.38 CPU) Benchmark: timing 500000 iterations of four_all, four_none, four_one... four_all: 7 wallclock secs ( 6.39 usr + 0.00 sys = 6.39 CPU) four_none: 7 wallclock secs ( 6.03 usr + 0.00 sys = 6.03 CPU) four_one: 7 wallclock secs ( 6.42 usr + 0.00 sys = 6.42 CPU) Benchmark: timing 500000 iterations of four_all, four_none, four_one... four_all: 6 wallclock secs ( 6.44 usr + 0.00 sys = 6.44 CPU) four_none: 7 wallclock secs ( 6.09 usr + 0.00 sys = 6.09 CPU) four_one: 7 wallclock secs ( 6.34 usr + 0.01 sys = 6.35 CPU) Benchmark: timing 500000 iterations of five_all, five_none, five_one... five_all: 7 wallclock secs ( 6.84 usr + 0.00 sys = 6.84 CPU) five_none: 6 wallclock secs ( 6.19 usr + 0.00 sys = 6.19 CPU) five_one: 7 wallclock secs ( 6.50 usr + 0.00 sys = 6.50 CPU) - Ian |