RFR: 8339531: Improve performance of MemorySegment::mismatch [v9]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Sep 5 17:53:56 UTC 2024
On Thu, 5 Sep 2024 17:47:16 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR proposes to improve the performance of `MemorySegment::mismatch` by using Java code rather than transitioning to native code.
>
> 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 175:
> 173: } else {
> 174: long i;
> 175: if (SCOPED_MEMORY_ACCESS.getByte(src.sessionImpl(), src.unsafeGetBase(), src.unsafeGetOffset() + srcFromOffset) !=
I looked at this the other day, and I couldn't immediately tell whether this test is needed or not - shouldn't it be covered by the subsequent loop? Is it a shortcut (but only for the first element) - how much does that buy really?
src/java.base/share/classes/jdk/internal/foreign/SegmentBulkOperations.java line 179:
> 177: return 0;
> 178: }
> 179: i = AbstractMemorySegmentImpl.vectorizedMismatchLargeForBytes(src.sessionImpl(), dst.sessionImpl(),
We should probably move `vectorizedMismatchLargeForBytes` in this class too, for clarity
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20848#discussion_r1745946359
PR Review Comment: https://git.openjdk.org/jdk/pull/20848#discussion_r1745944712
More information about the core-libs-dev
mailing list