RFR: 8339531: Improve performance of MemorySegment::mismatch [v9]
Brett Okken
duke at openjdk.org
Fri Sep 6 15:14:10 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 244:
> 242: return (Architecture.isLittleEndian()
> 243: ? Long.numberOfTrailingZeros(x)
> 244: : Long.numberOfLeadingZeros(x)) / 8;
Would there be value in having a constant LongToIntFunction lambda to capture this logic?
private static final LongToIntFunction LEADING_ZEROS = Architecture.isLittleEndian() ? Long::numberOfTrailingZeros : Long::numberOfLeadingZeros;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20848#discussion_r1747281751
More information about the core-libs-dev
mailing list