3 ms·
Thanks for the link. From this hn post, I'm baffled at how any other language could beat c at c ffi. (Hopefully your article explains how. Reading it now).
by ndesaulniers 8y ago
Thanks for the link. From this hn post, I'm baffled at how any other language could beat c at c ffi. (Hopefully your article explains how. Reading it now).
- gravypod 8y agoAm I getting this right? Is LuaJIT inlining linked assembly into the program at runtime? That's amazing.
- ndesaulniers 8y agoThat was my takeaway, but not sure to what extent. You could then do peephole optimization after. You'd lose out on the memory saving from shared objects, but that's a trade-off I'm cool with.
- fpgaminer 8y agoNot sure if LuaJIT will do that, but it's not doing that here. LuaJIT is calling the library just like normal. See my and glandium's comment thread. TL;DR: LuaJIT's trick is that it avoids the linkage table.
- ufo 8y agoInlining assembly at runtime is what JITs do.
- BeeOnRope 8y agoNo, it is not. It still makes a call to the method in the shared object, it's just the way this call is made is more efficient than C. "Inlinig" compiled assembly from a shared object is basically impossible because you can't just move machine code around arbitrary since it may access arbitrary additional code or data at relative offsets. If you move it, you'll break it.