lua-users home
lua-l archive

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


> So, my request for C API was logical if we think in term of the old
> Lua C function but if you adopt the new FFI paradigm you don't need
> the C API anymore, you just write Lua code and directly call C
> functions when needed.

Correct me if I am wrong, but I think FFI really improves performance, since it can optimally couple internal Lua variable representation with function call rather than doing regular parameters/stack packing known from C wrapper modules which means extra utility function calls.

For example calling C "double cos(double x)" with FFI should have same performance as calling it in C language using native types, since anyway LuaJIT uses doubles internally, so it can pass the parameters without almost no checking, no type conversion. At least this is what I expect and believe :)

Regards,
-- 
Adam Strzelecki