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

Xueming Shen xueming.shen at oracle.com
Thu Jan 16 18:08:19 UTC 2014


Hi,

The proposed changeset is to improve the performance (both speed and memory
usage) of String.toLowerCase/toUpperCase, by

(1) to separate the "most likely" use scenario (non supplementary character, no special
case mapping handling) into simple/quick iteration loop code path
(2) to use the package private constructor String(char[], boolean) to avoid unnecessary
target char[] copy in fast-path case.
(3) some tiny code cleanup.

Since it's supposed to be a simple/quick round of code cleanup, I did not go too far to
optimize the supplementary/special mapping code.

The webrev is

http://cr.openjdk.java.net/~sherman/8032012/

My small non-scientific speed measurement test suggests we can get 25% to 40%
speed boost.

http://cr.openjdk.java.net/~sherman/str_toCase/TestToCase.java

Thanks!
-Sherman



More information about the core-libs-dev mailing list