RFR: 8339531: Improve performance of MemorySegment::mismatch [v12]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Sep 12 11:37:07 UTC 2024


On Thu, 12 Sep 2024 11:30:12 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Fix yet another typo
>>  - Fix typo
>
> src/java.base/share/classes/jdk/internal/foreign/SegmentBulkOperations.java line 204:
> 
>> 202:         // This gives about 20% performance increase for large values of `length`.
>> 203:         // On non-Aarch64 architectures, the unroll code will be eliminated at compile time.
>> 204:         if (Architecture.isAARCH64() && NATIVE_THRESHOLD_MISMATCH > 64) {
> 
> I'm a bit opposed to this - as it goes in the direction to add a lot of transient complexity when in reality the underlying issue is that aarch64 mismatch intrinsics should be fixed. Tinkering with thresholds is borderline, but still acceptable - having different implementations one per platform starts to look "more wrong".

In other words, I don't think the goal of this (and related) PR is "improve mismatch so that it blows other alternatives - like Unsafe, or array" out of the water - as much as it is "make sure that using MemorySegment::mismatch is competitive with other offerings".

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20848#discussion_r1756678756


More information about the core-libs-dev mailing list