OpenHFT / Zero-Allocation-Hashing

Zero-allocation hashing for Java
Apache License 2.0
794 stars 136 forks source link

Support Compact String from JDK9 #46

Closed gzm55 closed 4 years ago

gzm55 commented 4 years ago

Add ModernCompactStringHash and CompactLatin1CharSequenceAccess to support JDK 9's compact string.

Close #20

leventov commented 4 years ago

Did you run benchmarks? Is the new approach actually faster?

gzm55 commented 4 years ago

@leventov Here is the jmh profiling results on the new access v.s. the original generic one. The three set of results are from the same perf branch.

For the getByte() methods, the tests covers aligned and unaligned offsets, others only aligned offsets. Each methods are tested for Latin1 and UTF16 strings. Latin1 ones are processed by the new compact access, while the UTF16 ones are processed by the unsafe access.

gzm55 commented 4 years ago

@leventov any time to review this pr and the benchmark result?