Categories
All articles

Python and Ruby Performance

by: Carl Johansson Published 9/03 - 2007

Is Python significantly faster than Ruby? The Computer Language Shootout says so. We’re working on setting up a small test suite of the type of computing we will need to do in our application, so we can do a fair benchmarking.

We’re also looking at what options are available to improve the performance. Ruby is waiting for YARV, which Antonio Cangiano recently benchmarked, and it looks very promising. Python has psyco, pypy, and several other options. Being able to integrate code written in other languages to optimize when really necessary is important, and both languages seem to have good support.

Has anybody else done customized benchmarking of these two languages for a specific web application?




Related Posts

Comments

6 Responses to “Python and Ruby Performance”
  1. Pablo says:

    The benchmark results alone are a insightful element when choosing the right language for the job. My choice here is Python 2.5, for speed.

  2. Luis says:

    I’m a Python fan with no experience with Ruby, and I’m glad that Python benchmarks well against other dynamic languages.
    However, and to be honest, if speed is an important factor when choosing a language, perhaps none of these is the right choice (at this moment).

    I think that in 90% (or more) of the cases, dynamic languages speed is more than enough.
    In those few cases where top speed is needed, C is the choice.

    When you need top speed, you will probably have to resort to C or write a c extension (no matter if you are using python, ruby or any other langauge).
    But if you don’t need the speed of C, it doesn’t really matter if you are using Python or Ruby. Any of these will be fast enough.

    That being said, be adviced that the Pypy project (python writen in python) is a very ambicious project with many goals.
    One of them is, of course, speeding up python. But the interesting thing is that the infraestructure and tools supplied by that project may be used to implement any other dynamic language very easily.
    People are writing already javascript, logo, scheme and many other front-ends in pypy, so chances are that sooner or later, someone will come up with a ruby implementation, and this implementation will enjoy all the advantages and capabilities of the python version.

    Isn’t that cool?

  3. Ventrix says:

    I totally agree with Luis. If speed doesn’t matter, then the appropriate language is the one the programmer knows better…

  4. roger says:

    Yeah Python is faster–especially with Psycho. But if you’re willing to live with the 3-6x slowdown, it doesn’t matter.

  5. Tomáš Holas says:

    I did an almost-real word test Ruby(both versions) vs. Python:
    http://railstooge.blogspot.com/2009/01/ruby-vs-python-lame-benchmark.html

  6. Ygor Lemos says:

    You really should take Google’s Pyhton Implementation ( Unladen Swallow ) into consideration… They are rewriting great part of Python’s code and main modules in C, optimizing the whole language for performance improvements.
    Guido van Rossum ( Python’s Creator ) is involved in the project and the speed improvements are really impressive ( taking Python far above any of the results gathered on benchmarks tests performed in many places )
    Also, you should consider Python 3.1 for the tests as many improvements in IO and many other parts of the codebase were rewritten and tend to be really faster than 2.x implementations.
    Overall, if speed is really a concern, go with C, C++, Assembly or any other “lower level” compiled language.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!