RFR: 8071571: Move substring of same string to slow path

Lev Priima lev.priima at oracle.com
Fri Mar 27 19:54:51 UTC 2015


Hi Ivan,

Thanks! Agree. Updated: 
http://cr.openjdk.java.net/~lpriima/8071571/1/webrev/

Lev

On 03/27/2015 06:17 PM, Ivan Gerasimov wrote:
> 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