Closed rohitjoshi closed 8 years ago
For sure the FFI is much, much faster (I don't think benchmarking at 10^7
is very realistic, and it takes so much time with Lua/LuaJIT it makes it harder to iterate).
In both cases (10^6
and 10^7
) you can find out that the FFI is more performant by about 85/90%. So I fail to see how the difference is larger with 10^7
. The thing to keep in mind is that yes, the FFI completely crushes any other implementation, as expected :D
Feel free to suggest performance improvements.
Hey,
As an attempt to reduce future confusion, I just added a field to the benchmark results to compare the % difference between existing solutions:
UUID generation (1e+06 UUIDs)
1. FFI binding took: 0.095588s -86%
2. C binding took: 0.234322s -66%
3. Pure LuaJIT took: 0.703376s +0%
4. Pure Lua took: 1.908608s +171%
Those are the same results as the ones you reported. As of today, I don't think LuaJIT can perform better for UUID v4 (unless I am missing some optimizations).
Also, feel free to use the provided bench.lua
benchmarks (you can edit the number of UUIDs and dataset to play with).
Hey @rohitjoshi,
Good news: we are now more performant than even the FFI binding itself ;)
Enjoy
@thibaultCha thanks for the update.
Performance comparing jit vs ffi seem to be much larger.
JIT:
FFI: