James Edward Gray II wrote:

>> Now it might be hard to determine which of these two is faster.

>And the results, from my G5:
>
>Benchmark: timing 3000000 iterations of all_ones, foreach, hash_slice, 
>map_hash, map_ones, range...
>   all_ones:  1 wallclock secs ( 1.76 usr +  0.00 sys =  1.76 CPU) @ 
>1704545.45/s (n=3000000)
>    foreach:  3 wallclock secs ( 2.39 usr +  0.00 sys =  2.39 CPU) @ 
>1255230.13/s (n=3000000)
>hash_slice:  1 wallclock secs ( 0.94 usr +  0.00 sys =  0.94 CPU) @ 
>3191489.36/s (n=3000000)
>   map_hash:  2 wallclock secs ( 1.43 usr +  0.00 sys =  1.43 CPU) @ 
>2097902.10/s (n=3000000)
>   map_ones:  4 wallclock secs ( 3.91 usr +  0.00 sys =  3.91 CPU) @ 
>767263.43/s (n=3000000)
>      range:  1 wallclock secs ( 2.20 usr +  0.00 sys =  2.20 CPU) @ 
>1363636.36/s (n=3000000)
>
>Looks like Rob is still the man to beat.  :D
>
Dang. Ok, Rob's original idea is the fastest solution, but he has to use exists later. 
Of the solutions not using exists, I come in third (range). That's not bad for an 
amateur or is it? ;)

- Jan
-- 
There are 10 kinds of people:  those who understand binary, and those who don't

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to