From: Aaron Smith Date: 2007-06-22T06:47:22+09:00 Subject: Re: Ruby extensions question.. MenTaLguY wrote: > 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 Thanks, Yes I have the ruby application RubyAMF already done. But I'm trying to optimize the AMF de/serialization and figured C would be the best solution. So now I just need write the C instead of worrying about Ruby/AMF integration.. Once the C is working, tie that back into Ruby/AMF. -- Posted via http://www.ruby-forum.com/.