On Thu, Mar 12, 2009 at 1:07 PM, Sam Ettessoc <sami...@gmail.com> wrote: > I would like to share a benchmark I did. The computer used was a > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > 10.5.6 and a lots of software running (a typical developer > workstation). > > Python benchmark: > HAMBURGUESA:benchmark sam$ echo 1+1 > bench.py > HAMBURGUESA:benchmark sam$ time python bench.py > real 0m0.064s > user 0m0.049s > sys 0m0.013s > > Ruby benchmark: > HAMBURGUESA:benchmark sam$ echo 1+1 > bench.rb > HAMBURGUESA:benchmark sam$ time ruby bench.rb > real 0m0.006s > user 0m0.003s > sys 0m0.003s > > Can you believe it? Ruby is 10 times faster than Python.
I submit that you are effectively just comparing start-up times: $ time ruby < /dev/null real 0m0.006s user 0m0.003s sys 0m0.003s $ time python < /dev/null real 0m0.020s user 0m0.011s sys 0m0.009s Since Python includes a full interactive interpreter REPL, whereas Ruby doesn't, you're comparing apples to oranges. A more fair comparison would be to compare python and irb: $ time irb </dev/null real 0m0.024s user 0m0.017s sys 0m0.006s And indeed, CPython is faster in a /slightly/ fairer comparison. Tests done using (since you neglected to include more detailed information about your setup): Mac OS X 10.5.6 on 2.6GHz Intel Core 2 Duo w/ 1.5GB of free RAM Python 2.6 ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin] irb 0.9.5(05/04/13) #I have no idea why this date is wrong Cheers, Chris -- I have a blog: http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list