David Garamond wrote:

> 1. Is there a way in Ruby to speed up 32bit integer arithmetics (only 
> involving numbers & sums up to 2^32-1)? I want to use Ruby for 
> summarizing network traffic logs, but it's pathetically slow compared 
> to Perl:
>
> $ time ruby -e'1000000.times{1073741823+1073741824}'
>
> real    0m23.693s
> user    0m5.720s
> sys     0m0.610s
> $ time perl -e'for(1..1000000){1073741823+1073741824}'
>
> real    0m1.142s
> user    0m0.320s
> sys     0m0.050s
>
> since 2**30 is already in the Bignum range.

i have the feeling (unconfirmed) that perl is optimising it away since 
the result is unused or the operation repeated or something. i created a 
file with 1000000 lines repeating the addition and perl is very slow too 
then (and ruby too).

i'm not sure.

emmanuel