[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Compiler Optimizations
- From: "Thomas Breuel" <tmbdev@...>
- Date: Fri, 31 Aug 2007 09:38:00 -0700
I think a better answer for all these optimization issues is to use a JIT.
For example, a JIT can perform inlining and use properties of metatables that a bytecode compiler can't, because the JIT really has the opportunity to observe the entire program and all of its operations. JVM and CLR's take advantage of that. For example, they can inline methods when there is no subclass, and remove the inlining when a subclass appears (even defined dynamically).
I'm not sure how far LuaJIT goes in these areas, but I think that's the place to implement such optimizations, leaving the bytecode generator to be a simple, mostly non-optimizing compiler. And, in fact, even without any fancy optimizations, LuaJIT probably already speeds up your code more than even the fanciest optimizations at the bytecode level could.