On Jan 17, 2007, at 2:00 AM, Shot (Piotr Szotkowski) wrote:

> Background: I'm a PhD student at Warsaw University of Technology and
> I need to write a project that's going to be fairly intensive in both
> computing and memory usage (symbolic functional decomposition of FSMs
> for FPGA implementation); [...]

Some work has been done in this area to some extent. Check out RHDL  
from Phil Tomson. I believe it is pure ruby only.

> The question: in my case, which approach seems to make most sense?
>
> 1. Pure Ruby. This will most probably not be an option; my gut
> feeling is that pure Ruby will end up being *way* too slow and
> memory-inefficient. Still, definitely the fun approach, and actually
> maybe the fastest prototyping.

Gut feelings are often wrong. Especially in this arena. You can also  
take advantage of very easy parallelism available through systems  
like rinda.

> 2. Ruby with C extensions. Code in Ruby first, then optimise the slow
> parts one after another. This is tempting (mmm, Ruby...), but I'm
> not sure how viable; if I'm going to have to rewrite 90% in C anyway,
> I might as well start with C++ (again, only a gut feeling).

This is the approach I choose most of the time. Just Do It. If it is  
slow, make the slow bits faster. It is exactly why RubyInline exists  
in the first place. Just make sure you do good profiling (use shugo's  
rubyprof or my zenprofiler--soon to be repackaged separately. Do NOT  
use the native one as anything more than a cursory glance, especially  
if your code does a ton of small method calls).

> 3. Pure C++. I have to learn C/C++ anyway almost certainly (for point
> 2 above), so maybe trying to have fun and going with Ruby is not the
> best way this time, and I should simply install CDT, stock on C++
> tutorials and be a brave, if sad, person?

Blech. Ptooey! I don't even consider this an option anymore.