python vs perl performance test

Jakub Stolarski jakub.stolarski at gmail.com
Thu Dec 13 16:23:27 EST 2007


On 13 Gru, 19:11, igor.tatari... at gmail.com wrote:

> There's got to be a simpler and more efficient way to do this.
> Can you help?
>
> Thanks,
> igor

If all you need is the result here's simpler and more efficient code:

from random import randrange
sum = 100 * randrange(128)
print "Sum is ", sum

And the same in perl:

my $sum = 100 * int(rand(128));
print "Sum is $sum\n";

If you really want compare performance then look at Computer Language
Benchmarks Game:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=python&lang2=perl



More information about the Python-list mailing list