Sponsor for 6666666: A better implementation of Character.isSupplementaryCodePoint

Martin Buchholz martinrb at google.com
Tue Mar 16 20:28:05 UTC 2010


On Tue, Mar 16, 2010 at 12:48, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> Here my additions:
>
> Am 13.03.2010 00:04, schrieb Martin Buchholz:
>>>
>>> - Why don't you like using the new isBMPCodePoint() for
>>> isSupplementaryCodePoint() and toUpperCaseCharArray() ?
>>>
>>
>> I now use it for the assert in toUpperCaseCharArray()
>>
>
>    return !isBMPCodePoint() && isValidCodePoint();
> resolves in same than current code.

Hmmmm......

Yes, you've convinced me!
Done.

>>> - Same shift magic would enhance isISOControl(), isHighSurrogate(),
>>> isLowSurrogate(), in particular if latter occur consecutive.
>>>
>>
>> isISOControl - yes, others - I am not convinced.
>>
>
> If virtually shifted by 8, HotSpot could use cheaper 1-byte compare on the
> high byte.
> Additionally, those methods are often used consecutively, so all 4 compares
> would benefit from.

Sorry, I'm still not convinced for the surrogate testing methods.
Almost all chars are less than MIN_SURROGATE, so you have to beat
the already amazingly cheap
x >= MIN_SURROGATE.

Martin



More information about the core-libs-dev mailing list