Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, I don't think Lua (or the author) is inlining the external function.

What's being JIT'd is the Lua code into machine code, and where Lua would need to call a C function, it (apparently) is just emitting a `call the_external_fn` into the JIT's resulting assembly. That's a direct function call, so it's about as fast as you're going to get, but somewhat counter-intuitively, it'll be faster than C, as we don't do anything with the PLT or indirection. Just call the function.



I think you need a layer of indirection there - you can't just directly call a function in another library in x64, whereas the library itself can. So in general the library should have a speed advantage when calling itself in x64.


Ahh got it, that makes sense -- thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: