From: Carl Youngblood Date: 2004-06-10T01:52:49+09:00 Subject: Re: ruby and mustard Charles Comstock wrote: >On Tue, 8 Jun 2004, Ara.T.Howard wrote: > > >>these are the options i've been mulling over. lately, however, i'm starting >>to favour this option: >> >> * just code it in c using ruby's builtin libs. gives you hashes, eval'ing >> code, lists, GC, etc. i'm not adding additional dependancies and >> guarunteed (if my c stays pretty posix) that my code will run where ruby >> will. don't need autotools, no stl., etc. etc. >> >>are there any other options i'm missing? >> >>what do you do when it needs to be __really__ fast BUT you also have to >>develop it __really__ fast and would __prefer__ not to add dependancies. >> >> > >Have you taken a look at rubyinline? It lets you embed compiled c >code inline in the middle of a ruby script. That way if you need to >run a fast loop you can switch to C but the cheap code that takes a >while in C is still doable in ruby. Can't remember the url for it, >should find it if you google. I want to say it's zenspiders work. > >Charlie > All of this discussion about C also reminds me that C code can itself be optimized considerably. If you really want to squeeze the last drop out of performance you can sometimes get even a twenty-fold improvement by doing architecture-specific optimizations. There are also plenty of platform-agnostic optimizations that can be done. A good book on this is /Computer Systems: A Programmer's Perspective/, Randal E. Bryant and David O'Hallaron. Carl