On Thu, 5 Sep 2024 17:58:11 GMT, Maurizio Cimadamore <[email protected]>
wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Fix errors in a benchmark
>
> src/java.base/share/classes/jdk/internal/foreign/SegmentBulkOperations.java
> line 211:
>
>> 209: final int s =
>> SCOPED_MEMORY_ACCESS.getInt(src.sessionImpl(), src.unsafeGetBase(),
>> src.unsafeGetOffset() + srcFromOffset + offset);
>> 210: final int d =
>> SCOPED_MEMORY_ACCESS.getInt(dst.sessionImpl(), dst.unsafeGetBase(),
>> dst.unsafeGetOffset() + dstFromOffset + offset);
>> 211: if (s != d) {
>
> Can we run `mismatch(s, d)` and then check the returned index (e.g. `!= 0`)
> instead of doing a full comparison and then another mismatch? Or is that
> slower?
Assuming the most likely outcome is the values `s` and `d` are the same, I
think the current way is faster. We avoid xor and counting bits which we likely
do not have any use for.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20848#discussion_r1754510267