RFR: JDK-8032012, , String.toLowerCase/toUpperCase performance improvement

Xueming Shen xueming.shen at oracle.com
Wed Feb 5 21:30:37 UTC 2014


Hi Remi,

Good suggestion. Now the "common case" path is much simple and faster :-)
I'm seeing a 5%-10% boost for the normal-non-surrogates case. And it appears
the bmp+surr mixed is getting faster as well. Though I would assume the it
would get slower in case of "no-case-folding" + surrogates. But the common
case wins here.

http://cr.openjdk.java.net/~sherman/8032012/webrev/

Thanks!
-Sherman

On 02/05/2014 01:00 PM, Remi Forax wrote:
>
> Hi Sherman,
> the code can be faster if the first loop call toLowerCaseEx in case of a surrogate instead of modifying srcCount because in that case the JIT will see that the increment is constant.
>
> Note that with the current code, the performance of toLowerCase if it was never called with a string that contains a surrogate are great but if toLowerCase is called once with a string that contains a surrogate, even if toLowercase is called after with strings that never contain a surrogate performance will be slower than it was. Calling toLowerCaseEx will make a toLowerCase with a surrogate slower but make toLowerCase faster in the common case.
>
> cheers,
> Rémi
>
>
>
>




More information about the core-libs-dev mailing list