RFR: 8321279: Implement hashCode() in Heap-X-Buffer.java.template [v5]
Alan Bateman
alanb at openjdk.org
Mon Dec 11 11:08:19 UTC 2023
On Sat, 9 Dec 2023 22:00:40 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
>
> - 8321279: Add benchmark
> - Merge remote-tracking branch 'origin/8321279' into 8321279
> - Update src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
>
> Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
> - Update src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
>
> Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
> - Merge branch 'master' into 8321279
> - 8321279: Fix hashCode()
> - 8321279: Fix hashCode()
> - 8321279: Fix build
> - 8321279: Fix build
> - 8321279: Fix build
> - ... and 2 more: https://git.openjdk.org/jdk/compare/03476ba1...9a17af63
test/micro/org/openjdk/bench/java/nio/ByteBuffers.java line 930:
> 928: public int testHashCode() {
> 929: return directByteBuffer.hashCode();
> 930: }
The change is for the heap based ByteBuffer, it looks like you've added a benchmark for a direct ByteBuffer.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16992#discussion_r1422309115
More information about the nio-dev
mailing list