RFR: JDK-8266431: Dual-Pivot Quicksort improvements (Radix sort) [v15]

Laurent Bourgès lbourges at openjdk.org
Thu Jul 7 17:52:54 UTC 2022


On Thu, 7 Jul 2022 15:58:33 GMT, iaroslavski <duke at openjdk.org> 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
>
> iaroslavski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   JDK-8266431: Dual-Pivot Quicksort improvements (Radix sort)
>   
>   * Added JMH

Thanks vladimir, your comment and test look good , even if I would not trust results for size < 200...

@AlanBateman 
If needed, a new system.property or flag could be added to disable heap-allocation or adjust the max heap ratio (1/128) as it may depend on use cases.
To insist, current jdk's Array.sort() does not have any heap limit (merge sort only) so this PR is a great achievement to reduce memory footprint compared to the current situation.

1/128th seemed to me a good upper limit as my compromise on speed vs memory, please propose any more conservative or appropriate threshold.

Laurent

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

PR: https://git.openjdk.org/jdk/pull/3938


More information about the core-libs-dev mailing list