|
From: | Dan Sugalski |
Subject: | Re: [Cardinal-dev] RubyInRuby parser/compiler |
Date: | Sun, 5 Jan 2003 19:08:50 -0500 |
At 9:58 PM +0100 1/5/03, Anders Bengtsson wrote:
Dan Sugalski wrote:>Don't know about constant folding...[---]This is a common optimization in more static languages, such as C, but may not be valid for Ruby.In general it isn't valid, but in most specific cases in Ruby it actually is. Most of the time '+' hasn't been changed.
I realize that more often than not the core class methods aren't different at compile and runtime, which we may take advantage of. The question is whether the current ruby interpreter doesn't do constant folding on purpose, or if it's something that Matz just never got around to doing.
It doesn't make much difference for Parrot, since we can certainly go either way--there aren't any technical reasons to force folding. It's just an optimization.
If the runtime system keeps track of which methods are changed and which are not, it can do a lot of constant folding and other optimizations. It just has to keep the non-optimized alternative available too, in case something changes. The Self language took this to extremes and got very good performance from a purely dynamic language.
We can, but we probably won't to start. It's a fair amount of work, and one thing we do lack is grad student slave labor. :)
-- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai address@hidden have teddy bears and even teddy bears get drunk
[Prev in Thread] | Current Thread | [Next in Thread] |