On Sat, 8 May 2021 20:54:48 GMT, iaroslavski
<[email protected]> wrote:
> Sorting:
>
> - adopt radix sort for sequential and parallel sorts on int/long/float/double
> arrays (almost random and length > 6K)
> - fix tryMergeRuns() to better handle case when the last run is a single
> element
> - minor javadoc and comment changes
>
> Testing:
> - add new data inputs in tests for sorting
> - add min/max/infinity values to float/double testing
> - add tests for radix sort
src/java.base/share/classes/java/util/DualPivotQuicksort.java line 669:
> 667:
> 668: for (int i = low; i < high; ++i) {
> 669: count1[ a[i] & 0xFF]--;
Not a reviewer, but having recently implemented a radixsort myself I'm
wondering what is the logic or benefit of decrementing and counting backwards
here?
One thing I did differently, and I'm not fully sure is an optimization, is
remembering the last bucket for each of the 4 counts. Checking whether the data
is already sorted by that digit can then be done by checking
`count[last_bucket] == size`, which avoids the first loop in `passLevel`.
Again, not sure whether it is actually faster, maybe the two separate simple
loops like here are better.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3938