John Lam (DLR) wrote:
> Charles Oliver Nutter:
>> Ruby 1.9, XRuby, IronRuby, Ruby.NET, and Rubinius run Ruby as compiled
>> bytecodes all the time (ok, you could say a bytecode interpreter, but
>> it's still a big step beyond walking an AST). JRuby includes a mixed
>> interpred/compiled mode for execution by default along with "all
>> interpreted" and "all compiled" modes. In fact, as far as I know, Ruby
>> 1.8 is the only version that's "only" interpreted at this point...all
>> other versions have compiled execution.
> 
> Actually, we've recently enabled an interpreted mode in IronRuby / DLR. We run interpreted by default until a method gets called multiple times, and then we compile. The exact heuristic hasn't been finalized yet, but we're forced to do this to do better on startup perf. The cost of JIT is rather expensive ...

I'll be interested to see what heuristic you come up with. Currently 
JRuby just uses "20 invocations" as the deciding moment. This ends up 
working great for small apps, where the code you want compiled gets 
compiled quickly. But for large apps, it seems we may want an upper 
limit on the number of JITed methods, since it can eventually swamp the 
system with barely-used code.

- Charlie