Sponsor for 6666666: A better implementation of Character.isSupplementaryCodePoint
Martin Buchholz
martinrb at google.com
Tue Mar 16 20:46:26 UTC 2010
On Tue, Mar 16, 2010 at 13:27, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> Am 13.03.2010 00:29, schrieb Martin Buchholz:
>
> Won't you like to add:
> * <p><b>Note:</b> In combination with {@link #isBMPCodePoint(int)} this
> * method should be in 2nd place to permit additional HotSpot compiler
> * optimization. Example:
> * <blockquote><pre>
> * if (Character.isBMPCodePoint(codePoint))
> * ...;
> * else if (Character.isSupplementaryCodePoint(codePoint))
> * ...;
> * else
> * ...;
> * </pre></blockquote>
> *
No.
This kind of implementation-specific comment is not
traditionally put in public javadoc (it's considered OK
in private comments). Also, we should not inflict our
dangerous micro-optimization disease on others.
>> 6934265: Add public method Character.isBMPCodePoint
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/public-isBMPCodePoint
>>
>
> Additionally please move static final int SIZE = 16 to one of the first
> lines of the code.
> See: https://bugs.openjdk.java.net/attachment.cgi?id=178&action=diff
No.
Although I agree with you that SIZE would be better near the top of the
class, I am not going to move it, at least not now.
For consistency, the SIZE fields in related classes like Short
should be moved as well.
>> 6934270: Remove javac warnings from Character.java
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/Character-warnings
>> 6934271: Better handling of longer utf-8 sequences
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/utf8-twiddling
>> 6666666: Optimize bit-twiddling in Bits.java
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/Bits.java
>>
>
> Hm, I can't see any difference that would merit to see it as
> micro-optimization. Am I blind?
Bytecode is smaller.
>> Now I need to go off to my micro-optimizers-anonymous meeting.
>>
>
> Oh, you are coming to Cologne, Germany. Nice to meet you personally.
Das letzte Mal war ich in Köln zu Bewerbungsinterview.
Leider nur Stellungen in der Versicherungsindustrie zu der Zeit.
Martin
More information about the core-libs-dev
mailing list