From: MenTaLguY Date: 2007-06-22T05:32:30+09:00 Subject: Re: Ruby extensions question.. On Fri, 22 Jun 2007 05:28:17 +0900, Aaron Smith wrote: > Thanks, helps more. I think where I'm going with this is that its best > to write a C program that does everything needed. Then come back and > extend Ruby with those pieces. Instead of worrying about Ruby > integration now, wait till the straight C functionality is there.. Then > there should only be slight overhead of a few rb_* calls. I'd actually say it's the other way around -- write the program in Ruby, then profile it to see where the slow spots are. Optimize those, and when you've run out of things to optimize in Ruby, _then_ see if you can cut down on method calls in critical places by pushing things into C. _if you need to_ (you may not) Trying to optimize too early just makes life harder for you, and there are a surprising number of gotchas when embedding Ruby in a C program (rather than vice-versa); the Ruby interpreter is not the most embedding-friendly. -mental