Character.java methods are slower than Surrogate.java's (original) (raw)

Ulf Zibis Ulf.Zibis at gmx.de
Wed Oct 28 14:44:53 PDT 2009


Hi Christian,

for a benchmark test I have replaced all sun.nio.cs.Surrogate methods in sun.nio.cs.ext.EUC_TW with corresponding ones from java.lang.Character.

As result, the overall encoding performance was 10 % worse, so java.lang.Character's methods must be much worser.

Can you have a look, if there is a chance to better optimize java.lang.Character methods from HotSpot compiler side.

The interesting classes to compare are here: https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/branches/all-in-charsets/test/sun/nio/cs/ext/EUC_TW_xueming.java?rev=805&view=markup https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/branches/all-in-charsets/test/sun/nio/cs/ext/EUC_TW_CharSurrogate.java?rev=805&view=markup https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/branches/all-in-charsets/test/sun/nio/cs/ext/EUC_TWBenchmark.java?rev=805&view=markup https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/branches/all-in-charsets/src/sun/nio/cs/ext/EUC_TW.java?rev=805&view=markup

If you like to build the project, follow the instructions on https://java-nio-charset-enhanced.dev.java.net/

My Results (EUC_TW_xueming is current JDK-algorithm, compare to EUC_TW_CharSurrogate): EUC_TW 65536 ASCII chars in 315 ms encoded to 65536 bytes EUC_TW_CharSurrogate 65536 ASCII chars in 346 ms encoded to 65536 bytes EUC_TW_xueming 65536 ASCII chars in 290 ms encoded to 65536 bytes

EUC_TW 65536 UniCodeBMP chars in 805 ms encoded to 231782 bytes EUC_TW_CharSurrogate 65536 UniCodeBMP chars in 810 ms encoded to 231782 bytes EUC_TW_xueming 65536 UniCodeBMP chars in 717 ms encoded to 231782 bytes

EUC_TW 65536 UniCodeCJK chars in 580 ms encoded to 131072 bytes EUC_TW_CharSurrogate 65536 UniCodeCJK chars in 592 ms encoded to 131072 bytes EUC_TW_xueming 65536 UniCodeCJK chars in 473 ms encoded to 131072 bytes

-Ulf



More information about the hotspot-compiler-dev mailing list