[TRIVIAL] Fast-path for String.subsring(n,n)

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Feb 25 16:41:49 UTC 2020


Hi Sergei!

Wouldn't it make sense to incorporate this fast path into 
StringUTF16.newString/StringLatin1.newString?

This way other callers of these methods will also benefit from it.

In particular, StringLatin1/StringUTF16.stripLeading(), 
StringLatin1/StringUTF16.stripTrailing() and maybe others could be 
slightly simplified.

With kind regards,

Ivan


On 2/25/20 7:42 AM, Сергей Цыпанов wrote:
> Hello,
>
> current implementation of String.substring(int,int) has a fast-path for the case when beginIndex = 0 and endIndex = length.
>
> I think there should be similar fast-path for the case beginIndex = endIndex (asuming both are valid):
>
-- 
With kind regards,
Ivan Gerasimov



More information about the core-libs-dev mailing list