[Israel.pm] unshift vs push&reverse

Shlomi Fish shlomif at iglu.org.il
Fri Mar 27 05:53:04 PDT 2009


On Friday 27 March 2009 14:22:34 sawyer x wrote:
> These are the following results that I have from Shlomi's first test:
> Benchmark: timing 50000 iterations of push, unshift...
>       push: 23 wallclock secs (21.02 usr +  0.03 sys = 21.05 CPU) @
> 2375.30/s (n=50000)
>    unshift: 27 wallclock secs (24.27 usr +  0.04 sys = 24.31 CPU) @
> 2056.77/s (n=50000)
>
>
> Apparently here, push is faster. This is Perl 5.10.0 so there might be
> push optimizations...

This is perl-5.10.0 too:

<<<
shlomi:~$ which perl
/usr/bin/perl
shlomi:~$ rpm -qf /usr/bin/perl
perl-base-5.10.0-24mdv2009.1
shlomi:~$
>>>

Maybe the Mandriva patches affect it somewhat. I can test it with other perl's 
I compiled myself, but not sure how important it is.

Regards,

	Shlomi Fish
-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/

God gave us two eyes and ten fingers so we will type five times as much as we
read.



More information about the Perl mailing list