Re: Question about String.toUpperCase behaviour

2019-10-31 Thread Сергей Цыпанов
> That doesn't remove the performance difference when the string is NOT upper > case. When the code is C2 compiler there is no significant difference, but in interpreter mode it's noticeable. @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(value = Mode.AverageTime) public class StringEquali

Re: Question about String.toUpperCase behaviour

2019-10-29 Thread Hans Boehm
On Tue, Oct 29, 2019 at 1:12 PM Rob Spoor wrote: > > I agree. There is no reason to use == instead of equals. Not for > readability, because it will most likely confuse people who will come > asking why you're not using equals. Not for performance, because since > at least Java 7 String.equals sta

Re: Question about String.toUpperCase behaviour

2019-10-29 Thread Rob Spoor
On 28/10/2019 21:34, Florian Weimer wrote: * Сергей Цыпанов: Hello, current implementation of e.g. String.toUpperCase() returns the object it was called on in case all code points are in upper case. E.g. this test @Test public void upperCase() { String str = "AZ";// Englis

Re: Question about String.toUpperCase behaviour

2019-10-28 Thread Florian Weimer
* Сергей Цыпанов: > Hello, > > current implementation of e.g. String.toUpperCase() returns the object > it was called on in case all code points are in upper case. > > E.g. this test > > @Test > public void upperCase() { > String str = "AZ";// English > assert str == str.toUpp

Question about String.toUpperCase behaviour

2019-10-28 Thread Сергей Цыпанов
Hello, current implementation of e.g. String.toUpperCase() returns the object it was called on in case all code points are in upper case. E.g. this test @Test public void upperCase() { String str = "AZ";// English assert str == str.toUpperCase(); str = "АЯ";