Search code examples
rubyperformancejrubymacrubyrubinius

High performance calculations with Ruby?


My colleagues normally use C or Fortran for high performance calculations (math on large arrays of data). I wonder if there is any possibility for Ruby code to be compiled/converted and come close to optimized C code in terms of performance?

There is a number of projects to compile Ruby to bytecode (Rubinius, JRuby, IronRuby, YARV?, Cardinal), and to native code (MacRuby, ..?). What are their chances to get close to C performance?

There is also almost 2-year as inactive project to convert Ruby code to C code: ruby2c.


Related questions:


Solution

  • There's one option you didn't include: It's rather easy to extend Ruby in C, so if you have a limited set of operations that need to be fast you can write a C extension and then use that from Ruby.

    http://people.apache.org/~rooneg/talks/ruby-extensions/ruby-extensions.html