Request for reviews (L): 6814842: Load shortening optimizations

Ulf Zibis Ulf.Zibis at
Fri May 8 10:01:16 PDT 2009

Am 08.05.2009 14:01, Christian Thalinger schrieb:
> On Fri, 2009-05-08 at 12:29 +0200, Ulf Zibis wrote:
>> Results from my benchmark on JDK7 b51:
>> <>
>> time for (char)a: 1652 ms
>> time for (char)(a & 0xFF): 2772 ms
>> IMHO (char)(a & 0xFF) should be faster, or at least as fast as (char)a, 
>> because only basic LoadUB should be executed.
> I already said that once, it's not the code the makes the second one
> slower, it's the register allocation.

Does that mean, that I should use (char)a to decode ASCII-bytes 
[0x00..0x7F] and (char)(a & 0xFF) to decode ISO-8859-1-bytes 
[0x00..0xFF] to have best performance? Using (char)(a & 0xFF) in general 
would waste performance for only-ASCII-bytes (...but win for 
ISO-8859-1-bytes, if using -XX:LoopUnrollLimit=1, see below).

>   When running with:
> -XX:LoopUnrollLimit=1

time for (char)a: 2280 ms
time for (char)(a & 0xFF): 2284 ms

How should I interpret this?
In case of ISO-8859-1-bytes it's faster than without 
-XX:LoopUnrollLimit=1, but slower in case of only-ASCII-bytes.
Which values are relevant for real world case? I'm not sure, which java 
code to use for most fast charset decoders.


More information about the hotspot-compiler-dev mailing list