Well, the question is whether the appending is
array = element array
or
array = array element
It turns out that you guys have all been testing perl's unshift.
Its unshift is highly inefficient. If you want to append to a list,
not prepend to it, then you use
push(@array, $element;
yeilding:
array = array element
saemantics instead.
The unshift version on my architecture runs this fast:
10.300u 0.190s 0:10.80
But the push version runs this fast:
0.840u 0.210s 0:01.01
That's a pretty dramatic speedup. Now, if you use version 5.0 and
ask that arithmetic be done in integer instead of floating point
by adding
use integer;
at the top of your program, then you get this performance:
0.690u 0.190s 0:00.85
Now, I agree that an order of magnitude difference between appending and
prepending is a bad idea, but unshift isn't a good way of measuring perl's
performance. My integer push version is 15 times faster than the floating
unshift version, which means that I may be able to infer that the perl
version is actually 3 times faster than the python version. I'd hate to
even compare it against tcl, which has a different mission and thus should
perhaps be excused from having a speed in this benchmark which seems to
vary from merely glacial to that of continental drift. :-)
--tom
-- "Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in." --Larry Wall in <1994Jul21.173737.16853@netlabs.com>Tom Christiansen Perl Consultant, Gamer, Hiker tchrist@mox.perl.com