[Memphis.pm] sorts
Keith W. Sheffield
sheff at pobox.com
Sat Oct 7 22:34:07 CDT 2000
>>>>> "Carl" == Carl Brock Sides <csides at autozone.com> writes:
> * Keith W. Sheffield <sheff at pobox.com> [001005 23:22]:
>> I though of ways to compact the sort demos given tonight and I got the
>> following scripts at the end of this post.
>>
>> (listing 1 is faster, BTW).
> Strange, listing 2 is faster on my machine.
> csides at tanuki:~/sorting$ time ./keith1.pl < ips > /dev/null
> real 0m5.123s user 0m4.990s sys 0m0.110s csides at tanuki:~/sorting$ time
> ./keith2.pl < ips > /dev/null
> real 0m2.982s user 0m2.840s sys 0m0.120s
> Using Benchmark.pm shows that the single pack is a lot more efficient
> than the join/map/sprintf combo:
That make a lot of sense. However, it could be due to the number of ips
being sorted. I was sorting 100000 ips, so maybe the speed gain by the
pack was being offset by having to do string compares instead of integer
compares.
--
-------------------- Keith W. Sheffield sheff at pobox.com --------------------
BLOOD. Running red and strong, down the Nile.
PLAGUE. Darkness three days long, hail to fire. -- RTL:CD v2 5-8
-------------- [lyrics copyright, Creeping Death Music, ASCAP] --------------
----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------
More information about the Memphis-pm
mailing list