New portion of improvements for Dual-Pivot Quicksort

Dmytro Sheyko dmytro_sheyko at hotmail.com
Thu May 20 11:25:09 UTC 2010


Hi Remi,

I believe that it is up to javac to generate compact and interpretation-efficient bytecode.
But anyway the first case seems to as acceptable as the second one. So I don't care which style is used (of course, if it's consistent).

Thanks,
Dmytro Sheyko

Date: Wed, 19 May 2010 12:09:57 +0200
From: forax at univ-mlv.fr
To: core-libs-dev at openjdk.java.net
Subject: Re: New portion of improvements for Dual-Pivot Quicksort






  


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
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100520/63e38508/attachment.html>


More information about the core-libs-dev mailing list