From: Robert Klemme Date: 2008-03-30T02:40:07+09:00 Subject: Re: Why Ruby do not optimize code at all? On 29.03.2008 18:03, s.ross wrote: > On Mar 29, 2008, at 9:50 AM, Robert Klemme wrote: > >> On 28.03.2008 18:21, s.ross wrote: >> >>> Before this question is relegated to the heap of "premature >>> optimization" ideas, I think the value of some level of programmer- >>> controller optimizations would be useful in the future. >> I guess you mean "programmer controlled", did you? In fact, there >> is plenty of room for that today already. There are numerous >> techniques that can be applied to code to make it faster. Often, >> proper design and / or algorithms make a huge difference. :-) > > Yes, "controlled". And yes, a good algo beats a machine optimization > almost every time. But still, some of the stupid optimization tricks > people have traditionally used for the last several percent destroy > the readability of code. I've never been terribly unhappy with the > performance of Ruby, but if I were ... say ... Industrial Light and > Magic and choosing between Ruby and Python to glue my effects stuff > together, I might be swayed toward Python because it preserves > bytecode (right?). I am not sure what you mean by "preserve bytecode". > It might be nice, once we figure out how to express > Ruby in an optimizable bytecode to create JIT optimizers that are > platform specific. Who knows what results that might yield. There is JRuby already. IMHO this is a good way to go because a lot of engineering went into JVM's already and that way Ruby can benefit from that without having to invest the same effort into the VM. > My original point, spelling not withstanding, is that this is a topic > (along with threading) that typically gets relegated to the premature > optimizations bin, and doesn't rise to the level of "this should be > possible one day and it should work with only the predictable > glitches." If I were heavily invested in my Java or C programming > skills, and wanted to keep Ruby out of my shop -- and there are people > who do fight to keep new technologies away -- lack of optimization > might be an attack plan. I guess even with such optimizations Ruby will never come close in performance to C and maybe even not to Java because of the highly dynamic nature. OTOH, if explicit enabling of certain optimizations disables some of the dynamic features that might be ok... > Again, just my opinion. No problem with that. I just wanted to make the half serious point that there *is* indeed a lot of room for programmer controlled optimization that does not need -O3. :-) Kind regards robert