Re[2]: Checking instanceof in DualPivotQuicksort

2019-11-01 Thread Vladimir Yaroslavskiy
Hi Brent, I agree with you, IllegalArgumentExceptions will help to catch invalid cases if we change the source in future. Please go ahead with integration. Thank you, Vladimir >25  Oct 2019, 8:28 +03:00 от Brent Christian : > >Hi, Vladimir > >I'd prefer to keep the code as is. Perhaps the exce

Re[2]: RFR: 8226297: Dual-pivot quicksort improvements

2019-10-24 Thread Vladimir Yaroslavskiy
Hi Brent, See my comments inline >Oct 24б 2019, 7:42 +03:00 от Brent Christian : > >Hi, > >I've created a webrev of the latest test changes that Vladimir sent me: > >http://cr.openjdk.java.net/~bchristi/8226297/webrev09-testUpdate/ > >(I also created an incremental webrev[1] along the way, in cas

Re[2]: RFR: 8226297: Dual-pivot quicksort improvements

2019-10-08 Thread Vladimir Yaroslavskiy
Hi Brent, Thank you for review, see my comments inline: >Oct 8, 2019, 1:53 +03:00 от Brent Christian : > >Hi, Vladimir > >I've read through the changes[1]. I have the following comments: > >--- >src/java.base/share/classes/java/util/Arrays.java > >* Regarding the indentation changes in the equal

Fwd: Re: Re[2]: Adaptive insertion sort in DualPivot Quicksort

2019-08-16 Thread Vladimir Yaroslavskiy
Hi Vladimir, I performed lots of benchmarks: 1. I updated my own sort-bench (jmh based) and run many tests (all distributions + permutations) on integer arrays for sizes = 50, 100, 150, 200, 500, 1000, 2000: In this benchmark, the metric is (minimum + stddev) and it gives the overall score: i

Re[2]: RFR: 8226297: Dual-pivot quicksort improvements

2019-08-06 Thread Vladimir Yaroslavskiy
Hi Brent,, I moved Object sorting related stuff after primitives sorting methods to separate functionality logically. The order of methods in my version is: 1. primitives (sequential sorting) - int - long - byte - char - short - float - double 2. primitives (parallel sorting) - int - long - byte

Re[2]: The final optimized version of Dual-Pivot Quicksort (ver.19.1)

2019-08-01 Thread Vladimir Yaroslavskiy
Hi Brent, see my comments inline: >Четверг, 1 августа 2019, 9:23 +03:00 от Laurent Bourgès >: > >Hi Brent, > >Le jeu. 1 août 2019 à 02:32, Brent Christian < brent.christ...@oracle.com > a >écrit : >>Thanks, Laurent.  I can sponsor this fix, get a RFR thread going for >>JDK-8226297, keep webre

Re[2]: Benchmarking of new optimized Dual-Pivot Quicksort

2019-07-26 Thread Vladimir Yaroslavskiy
Hi Laurent, Many thanks for feedback! I run tests on two computers under Windows (8 processors) and Linux (88 processors). The details of the first computer is: Window 10 (64-bit), Intel Core i7 8650U 1.90 GHz and output of "uname -a" command for the second computer is: Linux rho 4.15.0-54-gen

Re[2]: Bug in parallel sorting of float / double

2019-07-24 Thread Vladimir Yaroslavskiy
Hi David, Please, see how it works: Arrays.parallelSort(double[]) invokes  ArraysParallelSortHelpers.FJDouble.Sorter if size is big enough and ForkJoinPool.getCommonPoolParallelism()) > 1. FJDouble.Sorter divides given array into 4 parts, sorts them recursively in parallel and merges these parts

Re[2]:

2018-11-15 Thread Vladimir Yaroslavskiy
Hi Laurent, Actually the author of this test suite is Jon L. Bentley. I got Java version from Josh Bloch and later fixed minor bug and improved output. From my side no objections to put this code on github. Regards, Vladimir >Четверг, 15 ноября 2018, 10:23 +03:00 от Laurent Bourgès >: > >Hi Vl

Re: Re[2]: The new optimized version of Dual-Pivot Quicksort

2018-11-14 Thread Tagir Valeev
Hello, Laurent, Vladimir! I created a pull request containing my RadixSort implementation: https://github.com/bourgesl/nearly-optimal-mergesort-code/pull/1 On my machine the results produced by Mergesorts.java are like this: Runs with individual timing (skips first 10 runs): adjusted reps: 110 +

Re: Re[2]: The new optimized version of Dual-Pivot Quicksort

2018-11-12 Thread Laurent Bourgès
Hi, Do you know if someone has written a complete JMH benchmark suite dedicated to Arrays.sort() ? with varying array size (trivial) but also testing lots of data distributions: (see Vladimir's tests) and possibly all variants (int, long, double, Object[] ) It could be part of the standard OpenJD

Re: Re[2]: The new optimized version of Dual-Pivot Quicksort

2018-11-10 Thread Laurent Bourgès
Dear Vladimir & other Java sort experts, I made the port of the DPQS 2018.2 code last night to support a secondary array to be sorted and use preallocation (aux/run for merge sort): https://github.com/bourgesl/nearly-optimal-mergesort-code/blob/master/src/wildinter/net/mergesort/DualPivotQuicksort

Re: Re[2]: The new optimized version of Dual-Pivot Quicksort

2018-11-09 Thread Laurent Bourgès
Hi Vladimir, Thank you for your attention, you are the Sort Master. Le ven. 9 nov. 2018 à 09:02, Vladimir Yaroslavskiy a écrit : > Hi Laurent, > > The new version is still under review, there were a lot of suggestions and > ideas from Doug Lea. > I needed time to apply and check them. I'm goin

Re[2]: The new optimized version of Dual-Pivot Quicksort

2018-11-09 Thread Vladimir Yaroslavskiy
Hi Laurent, The new version is still under review, there were a lot of suggestions and ideas from Doug Lea. I needed time to apply and check them. I'm going to send final version in few days. As to new method sort(a[], low, high, indices): do you mean this method in Arrays class? Are you going

Re[2]: RFR(m): 8140281 deprecate Optional.get()

2016-04-28 Thread Victor Polischuk
I am sorry if my comment would be inappropriate, but is there a reason not to introduce "Optional ifAbsent(Runnable emptyAction)" and change signature of ifPresent to "Optional ifPresent(Consumer consumer)"? In that case method chaining would be more natural and it will give a decent way to ha

Re[2]: Speed optimization of Spliterators.spliteratorUnknownSize for parallel case

2015-07-13 Thread Tagir F. Valeev
Hello! Thank you for the detailed answer. PS> Thanks for looking at this. Judging by the results i am guessing PS> your measurements were performed on a 4-core system. Yes, quad-core, I mentioned it before. PS> My initial inclination for these scenarios is it is likely better PS> for the develo

Re: Re[2]: Implicit 'this' return for void methods

2014-03-28 Thread Eirik Lygre
On Fri, Mar 28, 2014 at 5:57 AM, Victor Polischuk wrote: > Ulf, > > I think that point leading style is something which can be easily > mistreat. If we complicate the example: > >String mySub = > myVeryLongNamedString.substring(.indexOf("C"),.indexOf("Q")); > > to something like: > >Strin

Re[2]: Implicit 'this' return for void methods

2014-03-27 Thread Victor Polischuk
Ulf, I think that point leading style is something which can be easily mistreat. If we complicate the example: String mySub = myVeryLongNamedString.substring(.indexOf("C"),.indexOf("Q")); to something like: String mySub = myVeryLongNamedString.concat("BLAH").substring(.indexOf("C"),.ind

Re[2]: Fw: Generics in enums

2013-05-30 Thread Victor Polischuk
Good day Joe, Thank you for your prompt reply. If I understood you correctly, it is not the solution which can help me distinguish enum elements by type parameters. I would like to have restrictions on types which can be passed to a enum instance methods and reduce numbers of casts or "instance

Re[2]: Dual-Pivot Quicksort improvements for highly structured (nearly sorted) arrays and data with small periods

2011-02-04 Thread Vladimir Iaroslavski
Hi Mike, Thank you for review! The value of the @version tag is date plus numbers which are not from any version control system. It is just abbreviation for changes and versions from my file tree. For example, "5\7" means improvement of pivot candidates, "p" - pair insertion sort, "m" - using of

Re: Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-06-21 Thread Osvaldo Doederlein
Hi Vladimir, 2010/6/19 Vladimir Iaroslavski > Hello Osvaldo, > > I've prepared simple test which scans an array and does assignments for > each element, > see attached Test class: > > a[k] = a[less]; > a[less++] = 0; // or a[less] = 0; less++; > > The result of running "java -client Test" is: >

Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-06-19 Thread Vladimir Iaroslavski
Hello Osvaldo, I've prepared simple test which scans an array and does assignments for each element, see attached Test class: a[k] = a[less]; a[less++] = 0; // or a[less] = 0; less++; The result of running "java -client Test" is: a[less], less++; Time: 6998 a[less++]; Time: 8416 It

Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-06-03 Thread Vladimir Iaroslavski
> > > > > sortNegZeroAndNaN(float[]...) but > > > > > > > > > probably > > > > > > > > > > > > >> forgot to change sortNegZeroAndNaN(double[]...). > > > > > > > > > > > > &

Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-05-17 Thread Vladimir Iaroslavski
> > > > > > > --- DualPivotQuicksort.java Tue May 11 09:04:19 2010 > > > > > > > +++ DualPivotQuicksortF.java Wed May 12 12:03:58 2010 > > > > > > > @@ -1705,11 +1705,7 @@ > > > > > > > } > > > > >

RE: Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-05-12 Thread Dmytro Sheyko
ds, Dmytro Sheyko > From: iaroslav...@mail.ru > To: j...@google.com; dmytro_she...@hotmail.com > CC: core-libs-dev@openjdk.java.net; iaroslav...@mail.ru > Subject: Re[2]: New portion of improvements for Dual-Pivot Quicksort > Date: Sun, 9 May 2010 23:51:27 +0400 > > Jo

RE: Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-05-07 Thread Dmytro Sheyko
ort(a, left, less - 1, leftmost); +dualPivotQuicksort(a, great + 1, right, false); } } > From: iaroslav...@mail.ru > To: j...@google.com; dmytro_she...@hotmail.com > CC: core-libs-dev@openjdk.java.net; iaroslav...@mail.ru > Subject: Re[2]: New portion of im

Re: Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-05-05 Thread Joshua Bloch
Vladimir, Fascinating. I don't know why this should be so. Joch On Wed, May 5, 2010 at 3:03 PM, Vladimir Iaroslavski wrote: > Josh, > > Quick note on changing > > int pivot1 = a[e2[; > int pivot2 = a[e4]; > > by > > int pivot1 = ae2; > int pivot2 = ae4; > > It is extremely surprised, but v

Re[2]: New portion of improvements for Dual-Pivot Quicksort

2010-05-05 Thread Vladimir Iaroslavski
Josh, Quick note on changing int pivot1 = a[e2[; int pivot2 = a[e4]; by int pivot1 = ae2; int pivot2 = ae4; It is extremely surprised, but version with local variables eats 5% (!) of time for client and 2% for server mode (in compare with one-pivot implementation from JDK 6), see:

Re[2]: How about Collections.emptySorted[Set|Map] ?

2010-04-17 Thread assembling signals
This is a nice idea! Additionally, (inspired by this idea,) emptyList() could return something that is castable to Deque (which is a sub-interface of Queue). Think of an empty plus unmodifiable LinkedList (which implements List, Deque, Queue). Deque d = (Deque) Collections.emptyList(); This, t

Re: 2 Questions on StringBuffer

2010-03-17 Thread Martin Buchholz
On Wed, Mar 17, 2010 at 14:24, Ulf Zibis wrote: > Am 17.03.2010 20:12, schrieb Martin Buchholz: >> >> On Wed, Mar 17, 2010 at 10:02, Ulf Zibis  wrote: >> >>> >>> Additionally I think, there's a bug in javadoc of those methods. >>> Actually they throw StringIndexOutOfBoundsException. >>> >> >> Why

Re: 2 Questions on StringBuffer

2010-03-17 Thread Ulf Zibis
Am 17.03.2010 20:12, schrieb Martin Buchholz: On Wed, Mar 17, 2010 at 10:02, Ulf Zibis wrote: Additionally I think, there's a bug in javadoc of those methods. Actually they throw StringIndexOutOfBoundsException. Why would that be a bug? I think, javadoc should indicate StringI

Re: 2 Questions on StringBuffer

2010-03-17 Thread Martin Buchholz
On Wed, Mar 17, 2010 at 10:02, Ulf Zibis wrote: > Am 17.03.2010 18:41, schrieb Martin Buchholz: >> >> On Wed, Mar 17, 2010 at 08:29, Ulf Zibis  wrote: >> >>> >>> Why there are 2 methods which do not use the super method, where I can't >>> see >>> any difference? : >>> >>>    public synchronized ch

Re: 2 Questions on StringBuffer

2010-03-17 Thread Ulf Zibis
Am 17.03.2010 18:41, schrieb Martin Buchholz: On Wed, Mar 17, 2010 at 08:29, Ulf Zibis wrote: Why there are 2 methods which do not use the super method, where I can't see any difference? : public synchronized char charAt(int index) public synchronized void setCharAt(int index, char

Re: 2 Questions on StringBuffer

2010-03-17 Thread Martin Buchholz
On Wed, Mar 17, 2010 at 08:29, Ulf Zibis wrote: > Why there are 2 methods which do not use the super method, where I can't see > any difference? : > >    public synchronized char charAt(int index) >    public synchronized void setCharAt(int index, char ch) You're correct that these methods could

Re: 2 Questions on StringBuffer

2010-03-17 Thread Ulf Zibis
Am 17.03.2010 17:36, schrieb Rémi Forax: Le 17/03/2010 17:29, Ulf Zibis a écrit : Why there are 2 methods which do not use the super method, where I can't see any difference? : public synchronized char charAt(int index) public synchronized void setCharAt(int index, char ch) Wouldn't e

Re: 2 Questions on StringBuffer

2010-03-17 Thread Rémi Forax
Le 17/03/2010 17:29, Ulf Zibis a écrit : Why there are 2 methods which do not use the super method, where I can't see any difference? : public synchronized char charAt(int index) public synchronized void setCharAt(int index, char ch) Wouldn't ensureCapacity better coded as follows? :

Re: Re[2]: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot

2009-09-12 Thread Goktug Gokdogan
In fact, at first I intentionally skipped the warming-up code, thinking that use of non-jvm optimized code could give some idea if more fine-tuning required in the implementation. Then I realized that results also includes the class loading times :(. So I added code that will just load classes by s