oertl commented on PR #20359: URL: https://github.com/apache/kafka/pull/20359#issuecomment-3311598993
@mimaison Apache Commons Codec still supports Java 8. `VarHandle`, which is essential for this performance boost, is unavailable there. I have reverted some optimizations to make the implementation equivalent to that of Apache Commons Codec (see [code](https://github.com/apache/commons-codec/blob/18ec4fbd66255745e52a02fe22cc6a304bcad180/src/main/java/org/apache/commons/codec/digest/MurmurHash2.java#L87)) and to make the review easier. The proposed implementation now only differs in variable names to keep the changeset small and the substitution of line `int k = MurmurHash.getLittleEndianInt(data, index);` by `int k = (int) INT_HANDLE.get(data, i4);`. The benchmark still shows a significant performance boost: ``` Benchmark (testCase) Mode Cnt Score Error Units Murmur2Benchmark.hashBytes TEST_CASE_1_4 avgt 20 4.671 ± 0.026 us/op Murmur2Benchmark.hashBytes TEST_CASE_1_16 avgt 20 7.319 ± 0.068 `us/op` Murmur2Benchmark.hashBytes TEST_CASE_1_64 avgt 20 15.558 ± 0.134 us/op Murmur2Benchmark.hashBytes TEST_CASE_1_256 avgt 20 46.943 ± 0.259 us/op Murmur2Benchmark.hashBytes TEST_CASE_4_4 avgt 20 5.877 ± 0.023 us/op Murmur2Benchmark.hashBytes TEST_CASE_16_16 avgt 20 9.482 ± 0.038 us/op Murmur2Benchmark.hashBytes TEST_CASE_64_64 avgt 20 23.735 ± 0.261 us/op Murmur2Benchmark.hashBytes TEST_CASE_256_256 avgt 20 84.939 ± 0.689 us/op ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
