[Israel.pm] unshift vs push&reverse

Berler Chanan bc.other at gmail.com
Sun Mar 29 00:00:33 PDT 2009


Wanna thank all of you.
I learned so much from my question:

1) I can use 1_00 10_00 numbers (didn't know I can do that).
2) I learned about a new module: Benchmark (shame on me...thought Gabor used
it literally)

Your humble uneducated (yet) and well known with my bizarre 
     questions of knowledge as a perl programmer.
         Chanan

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of Shlomi Fish
Sent: Friday, March 27, 2009 3:53 PM
To: perl at perl.org.il
Subject: Re: [Israel.pm] unshift vs push&reverse

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.

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://mail.perl.org.il/mailman/listinfo/perl
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.238 / Virus Database: 270.11.23/2016 - Release Date: 03/26/09
20:05:00



More information about the Perl mailing list