RFR: 8321279: Implement hashCode() in Heap-X-Buffer.java.template [v6]
Alan Bateman
alanb at openjdk.org
Tue Dec 12 07:50:43 UTC 2023
On Tue, 12 Dec 2023 07:43:48 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 14 additional commits since the last revision:
>
> - Merge branch 'master' into 8321279
> - 8321279: Adjust benchmark
> - 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
> - ... and 4 more: https://git.openjdk.org/jdk/compare/9200faaa...281e2af4
test/micro/org/openjdk/bench/java/nio/ByteBuffers.java line 928:
> 926:
> 927: @Benchmark
> 928: public int testHashCode() {
The methods in this benchmark are named testHeapXXX and testDirectXXX so this method will need to be renamed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16992#discussion_r1423569895
More information about the nio-dev
mailing list