String.lastIndexOf confused by unpaired trailing surrogate

Martin Buchholz martinrb at google.com
Wed Mar 24 07:32:13 UTC 2010


Hi Ulf,

You have this interesting optimization:

     public static boolean isSurrogate(char ch) {
-        return ch >= MIN_SURROGATE && ch < MAX_SURROGATE + 1;
+        return (ch -= MIN_SURROGATE) >= 0 && ch < MAX_SURROGATE + 1 -
MIN_SURROGATE;
     }

Do you have any evidence that hotspot can produce better code from this,
or that there is a measurable performance improvement?
Or was this just an experiment?

Martin



More information about the core-libs-dev mailing list