RFR: 8071571: Move substring of same string to slow path
Ivan Gerasimov
ivan.gerasimov at oracle.com
Fri Mar 27 15:17:27 UTC 2015
Hi Lev!
Why don't you want to also simplify String#trim()?
- return ((st > 0) || (len < value.length)) ? substring(st, len)
: this;
+ return substring(st, len);
I guess, the situation when a string *is* trimmed, i.e. substring() is
called is more common.
In that case we have a couple of duplicating condition checks (they're
going to be performed in substring() anyways) plus the cost of a branch.
Sincerely yours,
Ivan
On 27.03.2015 17:56, Lev Priima wrote:
> Please review small cleanup in java.lang.String:
>
> Issue: https://bugs.openjdk.java.net/browse/JDK-8071571
> Webrev: http://cr.openjdk.java.net/~lpriima/8071571/0/webrev/
>
> 46 tests from jdk9/dev/jdk/test/java/lang/String* passed locally.
>
More information about the core-libs-dev
mailing list