New portion of improvements for Dual-Pivot Quicksort

Rémi Forax forax at univ-mlv.fr
Wed May 19 10:09:57 UTC 2010


Le 19/05/2010 11:02, Dmytro Sheyko a écrit :
> Vladimir,
>
> I can see that you changed sortNegZeroAndNaN(float[]...) but probably 
> forgot to change sortNegZeroAndNaN(double[]...).
>
> You really puzzled me with failed testcase and note that sorting 
> algorithm (without special attention to zeros) generally may change 
> number of negative zeros.
> I will provide my comments later.
>
> As for counting sort, I think we should use single format style over 
> the file (unless we have valuable reason not to do this). I mean to choose
> 1)
>         if (toIndex - fromIndex > 
> COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR) {
>             countingSort(a, fromIndex, toIndex);
>             return;
>         }
>         sort(a, fromIndex, toIndex - 1, true);
> 2)
>         if (toIndex - fromIndex > 
> COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR) {
>             countingSort(a, fromIndex, toIndex);
>         } else {
>             sort(a, fromIndex, toIndex - 1, true);
>         }
> I prefer the second one.
>
> Thanks a lot,
> Dmytro Sheyko

But the former have a more compact bytecode representation (return vs 
goto) and avoid an unecessary jump for interpreters.

Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100519/29d183d3/attachment.html>


More information about the core-libs-dev mailing list