Coda Highland <
chig...@gmail.com> 于2025年5月3日周六 02:12写道:
>
> The performance delta when running vanilla Lua code is relatively small, yes, but there are two things that are where LuaJIT really starts to shine:
>
> * Code specifically optimized for LuaJIT can see a more significant performance benefit.
In my opinion, If we can spend our energy to optimize the code for
luajit, then it is better to find the part that needs to be optimized
and rewrite it with C code.
It can usually achieve better performance benefits (less uncertainty)
and make the software structure clearer.
> * LuaJIT's built-in FFI can be a lot faster than luaffi.
I don't like FFI, because this usually means that the core module
lacks good encapsulation, and data structure is not well designed.
When writing a C library, we usually need to think carefully about
which parts are more suitable to be placed in C side and what data
structures are more suitable for access from both C side and Lua side.
FFI makes these thoughts sloppy.
--
http://blog.codingnow.com