On Sun, 21 Sep 2025 19:47:14 GMT, Vladimir Yaroslavskiy <[email protected]> 
wrote:

> The goal of the PR is to improve both, sequential and parallel, sorting of 
> primitives.
> 
> **The main achievements**
> 
> - introduced Radix in parallel sorting which shows several times boost of 
> performance and has linear complexity instead of n*ln(n)
> - improved mixed insertion sort (makes whole sorting faster)
> - improved merging sort for almost sorted data
> - optimized parallel sorting
> - improved step for pivot candidates and pivot partitioning
> - suggested better buffer allocation: if no memory, it is switched to 
> in-place sorting with no OutOfMemoryError
> - minor javadoc and comment changes
> 
> - extended existing tests
> - added tests for radix sort, heap sort, insertion sort
> - added benchmarking JMH tests
> - improved test coverage
> 
> **The summary of benchmarking:**
> 
> **Sequential sorting (Arrays.sort)**
> 
> byte: up to 50% faster
> char: 4-7 times faster
> short: 2-6 times faster
> int: 1.2-5 times faster
> long: 1.2-5 times faster
> float: 1.2-5 times faster
> double: 1.2-4 times faster
> 
> **Parallel sorting (Arrays.parallelSort)**
> 
> int: 1.2-9 times faster
> long: 1.2-9 times faster
> float: 1.2-4 times faster
> double: 1.2-4 times faster
> 
> **AVX512 support**
> 
> Vamsi Parasa suggested faster sort routines by taking advantage of AVX512 
> instructions, see https://github.com/openjdk/jdk/pull/14227, sources of 
> sorting were modified. Therefore, I performed benchmarking of the final 
> version (which includes optimizations by Vamsi Parasa and optimizations from 
> my side) on a server with CPUs supported AVX512 instructions, no regression 
> of performance was found, see detailed benchmarking results.
> 
> I'm going on previous PRs https://github.com/openjdk/jdk/pull/3938 and 
> https://github.com/openjdk/jdk/pull/13568

It would be nice to have a high-level chart showing how the actual sorting 
algorithm is selected based on parallel/sequential, input size and whatever 
else. For an outsider, it's hard to grasp the whole picture. Is radix sort used 
for parallel sorting only? Sorry if such a chart already exists and I missed it.

If improvements of parallel sorting and sequential sorting are at least 
partially independent, I think it may make sense to deliver them in separate 
PRs. This would really simplify the review process.

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

PR Comment: https://git.openjdk.org/jdk/pull/27411#issuecomment-3317553265

Reply via email to