From: Hugh Sasse Date: 2005-09-03T01:38:40+09:00 Subject: Re: Ruby-specific performance heuristics? Wow, lots of good stuff already. I'm collecting these on the web (hope that's OK, attributed, slightly edited for brevity, no email addresses)... The page, which needs the formatting tweaking some more, is http://www.eng.cse.dmu.ac.uk/~hgs/ruby/performance/ as yet not linked into my ruby page, but Google will probably find it soon anyway... Things I'd like to comment on.... On Fri, 2 Sep 2005, Ara.T.Howard wrote: > - don't write explicit IO : use mmap and let the kernel worry about it I'm not familiar enough with mmap to understand this one :-) > > > - compose things out of array, hashes, and strings whenever possible. > these > objects are pretty optimized in ruby and serialize great as yaml meaning > you never need to write hand parsers. Do you mean, as opposed to creating new classes and composing with those? > > - cache anything possible, for instance methods dynamically generated from > method_missing : permanmently add the method to the object instead of > generating it everytime I've tried to do this and found performance has degraded. I'm not sure why, but think this post on Redhanded http://redhanded.hobix.com/inspect/theFullyUpturnedBin.html (unfortunately mauled by poker spammers, ), referencing http://whytheluckystiff.net/articles/theFullyUpturnedBin.html has something to do with it, and because of "Grab things in 8MB chunks" in particular. One case that stood out was caching results of floating point calculations involving roots: caching was slower. > > > now, i'm not saying these are 'right' - just that they are what i think of > when trying to make ruby fast. > > cheers. > > -a Thank you, All, Hugh