3 ms·
Binary translated libriscv vs LuaJIT: https://gist.github.com/fwsGonzo/9132f0ef7d3f009baa5b222eedf392da https://gist.github.com/fwsGonzo/9132f0ef7d3f009baa5b222
by fwsgonzo 3y ago
Binary translated libriscv vs LuaJIT: https://gist.github.com/fwsGonzo/9132f0ef7d3f009baa5b222eedf392da https://gist.github.com/fwsGonzo/9132f0ef7d3f009baa5b222eedf...
Interpreted libriscv vs LuaJIT: https://gist.github.com/fwsGonzo/1af5b2a9b4f38c1f3d3074d78acdf609 https://gist.github.com/fwsGonzo/1af5b2a9b4f38c1f3d3074d78ac...
libriscv vs. Luau: https://gist.github.com/fwsGonzo/5ac8f4d8ca84e97b0c527aec76a86fe9 https://gist.github.com/fwsGonzo/5ac8f4d8ca84e97b0c527aec76a...
wasmtime: https://medium.com/@fwsgonzo/using-c-as-a-scripting-language-part-10-ad7dd7e4325d https://medium.com/@fwsgonzo/using-c-as-a-scripting-language...
You're probably right that things can be improved. But my implementation has the aforementioned latencies right now.
For the benchmarks I did my best writing good Lua, but I am not a pro. Call overhead is also subtracted out of every benchmark after call overhead is measured. So that extra overhead is a permanent feature of these implementations. I also noticed that most of my script functions have at least ~3-4 arguments, which seems like it would be quite costly. Just look at the 8x arg benchmark and divide by 2, I guess. Another 100ns right there. Baseline 150ns on a micro benchmark is going to become at least a microsecond in prod when everything is random and semi-cold.
- stefanha 3y agoCool, thanks for sharing this information! I'm not a Lua or wasmtime developer, but I hope to learn from whatever discussion follows.