lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Jul 25, 2013 at 5:00 PM, Leo Romanoff <romixlev@yahoo.com> wrote:
replacing them by a more efficient indexed access (i.e. we know that field X is at offset 0, field Y at offset 4, etc) similar to what C compiler does or something like that? I think some JavaSctipt JITs and probably LuaJIT do something like this. But could Lua VM do a similar thing when it determines that a structure of the table never changes after a certain point in time?

That's exactly what LuaJIT can do. LuaJIT is the 'optimizing compiler' for Lua 5.1 and will find any opportunity to generate straightforward machine code.

But for Lua itself, it would complicate matters without changing the semantics.  Not a win, I think.