Character.java methods are slower than Surrogate.java's

View: New views
3 Messages — Rating Filter:   Alert me  

Character.java methods are slower than Surrogate.java's

by Ulf Zibis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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




Re: Character.java methods are slower than Surrogate.java's

by Christian Thalinger-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2009-10-28 at 22:44 +0100, Ulf Zibis wrote:

> 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.

I think you're already looking into this yourself.  -- Christian


Re: Character.java methods are slower than Surrogate.java's

by Ulf Zibis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am 07.12.2009 11:19, Christian Thalinger schrieb:

> On Wed, 2009-10-28 at 22:44 +0100, Ulf Zibis wrote:
>  
>> 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.
>>    
>
> I think you're already looking into this yourself.  -- Christian
>
>
>  
Yes, correct, I'm trying...

-Ulf