[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Luajit and curstom data structures
- From: Francesco Abbate <francesco.bbt@...>
- Date: Thu, 14 Apr 2011 14:10:44 +0200
2011/4/14 Adam Strzelecki <ono@java.pl>:
> 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 :)
Yep! As far as I understood this is actually the case, LuaJIT is able
to optimize FFI calls to the equivalent of compiled C code. For the
other side Mike exmplained that calling a Lua C function from Lua will
always have an important overhead that LuaJIT cannot eliminate. This
is why he was suggesting to use LuaJIT plus FFI calls instead of
writing Lua C functions.
Francesco
- References:
- Luajit and curstom data structures, KR
- Re: Luajit and curstom data structures, Mike Pall
- Re: Luajit and curstom data structures, KR
- Re: Luajit and curstom data structures, Mike Pall
- Re: Luajit and curstom data structures, Mike Pall
- Re: Luajit and curstom data structures, Francesco Abbate
- Re: Luajit and curstom data structures, Mike Pall
- Re: Luajit and curstom data structures, Francesco Abbate
- Re: Luajit and curstom data structures, Javier Guerra Giraldez
- Re: Luajit and curstom data structures, Francesco Abbate
- Re: Luajit and curstom data structures, Adam Strzelecki