Array equality, comparison and mismatch

2015-09-22 Thread Paul Sandoz
Hi, Please review the following which adds methods to Arrays for performing equality, comparison and mismatch: https://bugs.openjdk.java.net/browse/JDK-8033148 http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexico-compare/webrev/ http://cr.openjdk.java.net/~psandoz/jdk9/JDK-

Re: Array equality, comparison and mismatch

2015-09-22 Thread Tagir F. Valeev
Hello! Quite interesting feature. Isn't it a typo here? http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8136924-arrays-mismatch-vectorized-unsafe/webrev/src/java.base/share/classes/java/util/ArraysSupport.java.html 419if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[aFromIndex + i])) 487

Re: Array equality, comparison and mismatch

2015-09-23 Thread Paul Sandoz
On 23 Sep 2015, at 08:55, Tagir F. Valeev wrote: > Hello! > > Quite interesting feature. Isn't it a typo here? > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8136924-arrays-mismatch-vectorized-unsafe/webrev/src/java.base/share/classes/java/util/ArraysSupport.java.html > > 419if (!Float.isNaN

Re: Array equality, comparison and mismatch

2015-09-23 Thread Peter Levart
Hi Paul, Just some thoughts about nulls... Simple compare and compareUnsigned methods (without ranges) accept null arrays. They specify that indirectly by stating that they are consistent with equals methods that do the same. The equals methods specify that two null array references are equal

Re: Array equality, comparison and mismatch

2015-09-23 Thread Paul Sandoz
Hi Peter, On 23 Sep 2015, at 10:09, Peter Levart wrote: > Hi Paul, > > Just some thoughts about nulls... > Thanks, this is helpful. > Simple compare and compareUnsigned methods (without ranges) accept null > arrays. Yes. > They specify that indirectly by stating that they are consistent

Re: Array equality, comparison and mismatch

2015-10-05 Thread Chris Hegarty
Paul, On 22/09/15 17:30, Paul Sandoz wrote: Hi, Please review the following which adds methods to Arrays for performing equality, comparison and mismatch: https://bugs.openjdk.java.net/browse/JDK-8033148 http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexico-compare/webrev/

Re: Array equality, comparison and mismatch

2015-10-06 Thread Paul Sandoz
> On 5 Oct 2015, at 17:35, Chris Hegarty wrote: > > Paul, > > On 22/09/15 17:30, Paul Sandoz wrote: >> Hi, >> >> Please review the following which adds methods to Arrays for performing >> equality, comparison and mismatch: >> >> https://bugs.openjdk.java.net/browse/JDK-8033148 >> >> htt

Re: Array equality, comparison and mismatch

2015-10-06 Thread Chris Hegarty
On 6 Oct 2015, at 09:50, Paul Sandoz wrote: >> >> On 5 Oct 2015, at 17:35, Chris Hegarty wrote: >> >> Paul, >> >> On 22/09/15 17:30, Paul Sandoz wrote: >>> Hi, >>> >>> Please review the following which adds methods to Arrays for performing >>> equality, comparison and mismatch: >>> >>> h

Re: Array equality, comparison and mismatch

2015-10-07 Thread Paul Sandoz
> On 6 Oct 2015, at 10:58, Chris Hegarty wrote: >>> It was not immediately obvious to me that the common prefix can be 0. >>> Should this be called out specifically? >>> >> >> When reading the documentation of compare or mismatch or both? > > mismatch. But maybe this is just me. > I could

Re: Array equality, comparison and mismatch

2015-10-07 Thread Chris Hegarty
On 7 Oct 2015, at 16:55, Paul Sandoz wrote: > >> On 6 Oct 2015, at 10:58, Chris Hegarty wrote: It was not immediately obvious to me that the common prefix can be 0. Should this be called out specifically? >>> >>> When reading the documentation of compare or mismatch or both? >

Re: Array equality, comparison and mismatch

2015-10-12 Thread Paul Sandoz
> On 22 Sep 2015, at 18:30, Paul Sandoz wrote: > > Hi, > > Please review the following which adds methods to Arrays for performing > equality, comparison and mismatch: > > https://bugs.openjdk.java.net/browse/JDK-8033148 > > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexic

Re: Array equality, comparison and mismatch

2015-10-12 Thread Andrej Golovnin
Hi Paul, wouldn't it be better to use Objects#equals(Object, Object) in the line 3293 in the Arrays class instead of the ternary operator (the same applies to the line 3238)? Best regards, Andrej Golovnin On Mon, Oct 12, 2015 at 9:31 AM, Paul Sandoz wrote: > >> On 22 Sep 2015, at 18:30, Paul Sa

Re: Array equality, comparison and mismatch

2015-10-12 Thread Paul Sandoz
> On 12 Oct 2015, at 09:47, Andrej Golovnin wrote: > > Hi Paul, > > wouldn't it be better to use Objects#equals(Object, Object) in the > line 3293 in the Arrays class instead of the ternary operator (the > same applies to the line 3238)? > Thanks updated both the Arrays.equals and Arrays.mism

Re: Array equality, comparison and mismatch

2015-10-12 Thread Mike Duigou
On 22 Sep 2015, at 18:30, Paul Sandoz wrote: Hi, Please review the following which adds methods to Arrays for performing equality, comparison and mismatch: https://bugs.openjdk.java.net/browse/JDK-8033148 http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexico-compare/webrev/

Re: Array equality, comparison and mismatch

2015-10-12 Thread Paul Sandoz
> On 12 Oct 2015, at 19:50, Mike Duigou wrote: > > >>> On 22 Sep 2015, at 18:30, Paul Sandoz wrote: >>> Hi, >>> Please review the following which adds methods to Arrays for performing >>> equality, comparison and mismatch: >>> https://bugs.openjdk.java.net/browse/JDK-8033148 >>> http://cr.ope

Re: Array equality, comparison and mismatch

2015-10-12 Thread Mike Duigou
- I apologize if this was discussed earlier in the thread but why is the comparison of floats and doubles done by first == operator of the int bits and only then the compare method ? I was being consistent with the test used for the existing equals methods of float[] and double[]. Note that t

Re: Array equality, comparison and mismatch

2015-10-13 Thread Paul Sandoz
> On 13 Oct 2015, at 05:46, Mike Duigou wrote: > >>> - I apologize if this was discussed earlier in the thread but why is the >>> comparison of floats and doubles done by first == operator of the int bits >>> and only then the compare method ? >> I was being consistent with the test used for t

Re: Array equality, comparison and mismatch

2015-10-13 Thread Andrew Haley
On 13/10/15 10:22, Paul Sandoz wrote: > Analysis so far indicate big gains are to be had on larger arrays with better > or no impact on small arrays if i do the following instead: > > if (Double.doubleToRawLongBits(a[i]) != > Double.doubleToRawLongBits(b[i])) { > int c = Double.comp

Re: Array equality, comparison and mismatch

2015-10-15 Thread Paul Sandoz
> On 13 Oct 2015, at 12:03, Andrew Haley wrote: > > On 13/10/15 10:22, Paul Sandoz wrote: >> Analysis so far indicate big gains are to be had on larger arrays with >> better or no impact on small arrays if i do the following instead: >> >> if (Double.doubleToRawLongBits(a[i]) != >> Doubl

Re: Array equality, comparison and mismatch

2015-10-15 Thread Andrew Haley
On 10/15/2015 11:52 AM, Paul Sandoz wrote: > I would be very interested in your opinion on being able to make > intrinsic on ARM the method ArraysSupport.vectorizedMismatch [1]. Pretty easy, I'm sure. We already have MacroAssembler::string_compare which does essentially the same thing but with ch