Elektrine lite

← Feed

@david_chisnall@infosec.exchange

Post #2707875

2026-04-15 12:04 UTC

@ltratt@mastodon.social This hopefully makes the trade-off yk offers clear: yklua does not reach the performance peaks of the wonderful, carefully hand-written, LuaJIT For what it's worth: In igk, I use sol3, which lets you select the Lua implementation as a build-time option. I don't use any fancy new Lua features in this (64-bit integers are really important for some other things where I looked at Lua, but not for igk), so I tried both Lua and LuaJIT. There wasn't much difference in terms of performance, but LuaJIT was a bit slower than the interpreter. My guess is that this is primarily because FFI is slower with LuaJIT and my code did a lot of FFI (basically everything it's doing is calling back into C++ to manipulate the text tree). I presume that yklua uses exactly the same memory layout as the C version, so I'd expect it to be better here. This is also a problem with a lot of Python JITs: If you make Python faster and make CPython-compatible FFI slower, you generally make Python programs slower.

Replies (1)

  • @ltratt@mastodon.social 2026-04-15 12:24

    @david_chisnall@infosec.exchange I assumed that LuaJIT did quite a good job with FFI performance (the API it defined has spread more widely), but I haven't benchmarked it! That said, there are some heuristics in LuaJIT that do not always play well with real-world code. yklua will just do whatever PUC Lua does, but it will probably inline right up until the FFI call, which might help. That said, right now, you can still hit missing bits that tank performance in any yk interpreter, so it's difficult to say!

    Open ##2707876