Open Spasi opened 5 years ago
Hi Ioannis, thanks for scrutinising the results and giving some feedback. I'll definitely look into it when I get time, but what immediately jumps to mind is the differences between GetPrimitiveArrayCritical
and GetDirectBufferAddress
since I was measuring with byte[]
s. Of course, this also makes the choice of garbage collector a factor to be controlled.
Hey Richard, after reading the blog post I was troubled by how slow the JNI implementation was.
Running the benchmark locally (on a Ryzen 1800X) indeed produces the same relative differences. I'm not sure how lz4-java compiles xxhash and how it handles the JNI bindings, but I could not reproduce such bad performance using LWJGL (it has both lz4 and separate xxhash bindings). In my testing, LWJGL's xxhash is noticeably faster than a Java implementation, except for tiny array sizes.
So, just letting you know in case you'd like to test an alternative option. Note, LWJGL supports direct ByteBuffers only, but that shouldn't be a problem. The latest 3.2.3 snapshot has also updated xxhash to 0.7.1 and includes the faster XXH3 algorithm.
You can find an LWJGL benchmark, here.