[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is it supposed to be faster to call a C function than a Lua function when in Lua?
- From: Justin Cormack <justin@...>
- Date: Fri, 28 Jun 2013 00:25:58 +0100
On Thu, Jun 27, 2013 at 9:06 PM, Eric Wing <ewmailing@gmail.com> wrote:
>> It's only expensive to use the Lua C API when working with LuaJIT, and then
>> only relatively - there the strategy is to use the compiled FFI interface.
>
> Do you have any numbers/stories you can share about how the FFI
> performance compares? (I've dealt with libffi myself in LuaCocoa but
> haven't benchmarked it. Marshaling parameters to and from ffi data
> structures was quite tedious to write but I never benchmarked how that
> translated to speed in practice.)
The LuaJIT ffi when JIT compiled has no overhead at all, it is just
the same as a C to C call. But iOS does not support JIT, which means
calling the ffi API it is actually slower than calling the standard
Lua C API.
Justin