On Friday 06 June 2008 14:19:12 Philip Rhoades wrote:

> The reason I am interested is that I have CPU and IO intensive C/C++ 
> genetics simulation program that I would love to rewrite in Ruby but it 
> probably would not be viable from a speed point of view.

First, you could try Ruby 1.9. Probably more reliable than ruby2c, and much 
faster than Ruby 1.8.

But probably the simplest Ruby speed hack is to rewrite the more 
performance-intensive parts as C extensions, which you call from Ruby. That's 
common for Python and Perl, too. But premature optimization is evil -- write 
it in Ruby first, then profile it to find out what actually needs to be C.

Another way would be to keep some sort of base engine in C, and embed Ruby 
into it. This is common for games -- write the game engine in C/C++, with 
some inline assembly, and add a scripting language (often Lua or Python) to 
do the actual game logic.