MenTaLguY
6/21/2007 11:17:00 PM
On Fri, 22 Jun 2007 06:47:22 +0900, Aaron Smith <beingthexemplary@gmail.com> wrote:
> 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.
Ah, {de,}serialization code is one of those places where C is more often helpful.
That said, have you done profiling and taken advantage of all of the
pure Ruby optimization opportunities you've had first?
Performance bottlenecks can happen in very unexpected places, and heavily optimizing
one part of the code won't help you much if 90% of the execution time is happening
in a different part.
Another question to consider is if you are interested in supporting other Ruby
implementations (e.g. JRuby or Ruby.NET). If so, then it's best to minimize the
amount of code you push into C.
Along those lines, profiling may highlight one or two specific methods that need
to be done in C, versus rewriting a large part of the application.
-mental