From: Bill Kelly Date: 2003-04-09T17:16:30+09:00 Subject: Re: [Q] Ruby for graphics Hi, From: "Bil Kleb" > > Bill Kelly wrote: > > > > In addition to all my other uses for Ruby, I do actually use Ruby to > > prototype graphics algorithms: precisely because Ruby is such a high- > > level, powerful language. But I do expect to re-code the finished > > algorithms in C++ for speed. > > After measuring the bottlenecks and only corrected those as necessary? > Or a complete re-write? I think I probably spoke a bit over-generally, based on my project- of-the-moment. I'm a huge fan of measuring before optimizing, and I've been (indeed) doing some rough C++ timing estimates while coding the Ruby sample implementation of what are intended to be some very real-time pixel filtering operations. In Ruby it was convenient for me to develop the filter in an object- oriented manner... but now that I understand how the filter works, it boils down to a few memory fetches, some arithmetic, and a few memory stores per pixel. I *could* optimize the Ruby version a bit, of course - now that I know how to actually code the thing. . . My current Ruby implementation gets less than one frame per second on a 120x144 buffer, whereas my rough C++ timing tests indicate I should achieve a few thousand frames a second on that sized buffer in that language. . . . But my Ruby implementation was never intended to *be* fast... I used Ruby to explore an idea and learn how to achieve the filtering effect I desired... So in essence I guess I've selected about the most inappropriate task for which to use Ruby from a speed perspective - but I knew that going into it... The whole filter *is* the bottleneck. :) But I still found Ruby very useful in developing it. Regards, Bill