RFR: 8321279: Implement hashCode() in Heap-X-Buffer.java.template [v7]
Sergey Tsypanov
stsypanov at openjdk.org
Tue Dec 12 11:14:35 UTC 2023
On Tue, 12 Dec 2023 08:01:47 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:
>> Currently `Heap*Buffer.hashCode()` is inherited from `*Buffer` and implemented as
>>
>> public int hashCode() {
>> int h = 1;
>> int p = position();
>> for (int i = limit() - 1; i >= p; i--)
>> h = 31 * h + (int)get(i);
>> return h;
>> }
>>
>> This can be improved using `ArraysSupport.vectorizedHashCode()`
>
> Sergey Tsypanov has updated the pull request incrementally with one additional commit since the last revision:
>
> 8320971: Rename method
I've run the tests again on VM, no significant difference
master
Benchmark (size) Mode Cnt Score Error Units
ByteBuffers.testHeapHashCode 16 avgt 30 9.956 ? 0.537 ns/op
ByteBuffers.testHeapHashCode 1024 avgt 30 639.355 ? 4.158 ns/op
ByteBuffers.testHeapHashCode 131072 avgt 30 84327.624 ? 1231.085 ns/op
patch
Benchmark (size) Mode Cnt Score Error Units
ByteBuffers.testHeapHashCode 16 avgt 30 7.791 ? 0.158 ns/op
ByteBuffers.testHeapHashCode 1024 avgt 30 669.107 ? 10.464 ns/op
ByteBuffers.testHeapHashCode 131072 avgt 30 85484.992 ? 2064.665 ns/op
I think in a week I'll be able to run this on Linux machine
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16992#issuecomment-1851829328
More information about the nio-dev
mailing list