RFR: JDK-8266431: Dual-Pivot Quicksort improvements (Radix sort)
iaroslavski
github.com+43264149+iaroslavski at openjdk.java.net
Mon Sep 13 17:28:50 UTC 2021
On Tue, 18 May 2021 18:06:21 GMT, Nils Eliasson <neliasso at openjdk.org> wrote:
>> src/java.base/share/classes/java/util/DualPivotQuicksort.java line 672:
>>
>>> 670: count2[(a[i] >>> 8) & 0xFF]--;
>>> 671: count3[(a[i] >>> 16) & 0xFF]--;
>>> 672: count4[(a[i] >>> 24) ^ 0x80]--;
>>
>> It seems that C2 can't eliminate the bounds check here because of the `xor`, even though this can't possibly exceed 256. The three masked accesses above are all eliminated. Maybe someone could look in to improving that.
>
> https://bugs.openjdk.java.net/browse/JDK-8267332
I agree with Laurent (bourgesl), see his comment on May 15 regarding to xor:
using Unsafe is only 2% faster, not worth the extra complexity for few percent.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3938
More information about the core-libs-dev
mailing list