4 ms·
The native code isn't being inlined into the compiled LUA code - it is still making a function call. It's just that the way it happens to do the call is faster
by BeeOnRope 8y ago
The native code isn't being inlined into the compiled LUA code - it is still making a function call.
It's just that the way it happens to do the call is faster than C calling a function in a shared object.
- cryptonector 8y agoRepeat after me: TFA is not about C nor Lua, it's about static vs. dynamic linking only.
- BeeOnRope 8y agoDid you actually read it? It compares three cases: dynamic linking, calls through a function pointer and calls where the address to call is compiled directly into an immediate call instruction using a small JIT intended to emulate the LuaJIT case. The benchmark didn't even include a static linking case! In general, however, I expect the static linking case to perform like the JIT case since both will almost always use a call with 32-bit relative immediate jump. I was a bit confused about why the article author chose to write a JIT rather than just use static linking, since I think they achieve the same thing here.