lua-users home
lua-l archive

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


On Fri, Jul 3, 2009 at 8:04 AM, steve wrote:
> Inling performance-critical code can be an effective trick:

That approach is to compile C into a shared library that is called
from Lua, which is fairly typical except that additional conveniences
allow the C to be written inline and without binding boilerplate.  A
related idea is shown in [1].

I've considered trying a different approach with lua2c [2] but have
not had the time to go far with it.  lua2c already converts Lua to C.
Taking it to the next level of inlining C into Lua would be very
natural because the inlined C can be directly inlined into the
translated C.  For example, you can have a Lua algorithm that operates
on both Lua and C data structures without writing a binding to those C
data structures.  The C compiler will even optimize across the
boundary between C and Lua, which I understand LuaJIT does not do.
This type of thing might have a niche.  The generated C might even be
consumed by LLVM.

[1] http://lua-users.org/wiki/InlineCee
[2] http://lua-users.org/wiki/LuaToCee