A few char-fiddling optimizations for Pattern.java
Martin Buchholz
martinrb at google.com
Fri Apr 16 00:52:52 UTC 2010
On Thu, Apr 15, 2010 at 17:23, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
>>
>> Hi Xueming and Ulf,
>>
>> Please review a few more optimizations to be added to the
>> current crop:
>>
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/Pattern-opt/
>>
>>
>
> Have you tried to disassemble? :
No. Have you?
> private static final boolean isSupplementary(int cp) {
> returnCharacter.isSurrogate((char)cp) ||
> // in this case method should be namedisSupplementaryOrHigher():
> // cp>= Character.MIN_SUPPLEMENTARY_CODE_POINT);
> Character.isSupplementaryCodePoint(cp);
>
> }
>
> Maybe HotSpot would compile to same code.
That seems unlikely to me.
> Anyway I think, such functionality should belong to class Character.
I disagree.
> And don't forget the 8-space indentation rule for line continuation. ;-)
>
>
> Use Character.codePointCount(...) instead ;-) :
Good point! I deleted countCodePoints,
especially since it is not used in performance-critical code.
Webrev regenerated.
Martin
> countCodePoints(CharSequence seq)
>
>
> -Ulf
>
>
>
>
>
>
>
>
More information about the core-libs-dev
mailing list