lua-users home
lua-l archive

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

Leo Razoumov wrote:
> > In Lua we can do the same: specialize the Lua code at runtime for
> > the number of dimensions, memoize the code in a table and dispatch
> > based on the dimension. I.e. string.format + loadstring +
> > memoization table.
> It would be great if this specialize/memoize/dispatch optimization for
> small number of dimensions could make it into LuaJIT-2.0 release.

Umm, you misunderstood: this out of the scope of what a compiler
automatically can or should do for you. C++ compilers don't write
templates for you, either. :-) It's pretty easy to do it yourself
in Lua, far easier than writing C++ templates.