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

Xueming Shen xueming.shen at oracle.com
Thu Feb 6 18:47:30 UTC 2014


On 02/06/2014 10:30 AM, Ulf Zibis wrote:
>
> Am 06.02.2014 18:40, schrieb Xueming Shen:
>> Ulf,
>>
>> webrev has been updated to use isBmpCodePoint() as suggested. Another
>> benefit of using isBmpCodePoint() is that some Character.ERROR checks
>> are no longer necessary
>
> Great, I didn't see that.
>
> But why not just coding:
> 2558             char ch = value[first];
> 2559             if (Character.isSurrogate(ch) {
> 2560                 hasSurr = true;
> 2561                 break;
> 2562             }
> 2563             if (ch != Character.toLowerCase((int)ch)) {  // no need to check Character.ERROR
> 2564                 break;
> 2565             }
>
> -Ulf
>

There is no measurable difference. I'm fine with either way. Given we are on
a 32/64-bit platform, it might be better to just use the "word" size type? :-)

-Sherman




More information about the core-libs-dev mailing list