A question about bytecodes + unsigned load performance ./. add performace

Ulf Zibis Ulf.Zibis at gmx.de
Fri Jan 9 19:03:16 PST 2009



Am 10.01.2009 03:55, Ulf Zibis schrieb:
>
> The code, for which the table swapping is done :
>
>    byte[] byteBuf;
>    char[] charBuf;
>    int j = offset;
>    for (int i=0; i<buf.length; i++,j++)
>        charBuf[j] = decode(byteBuf[i]);
>    ....
>    public char decode(byte inByte) throws 
> UnmappableCharacterException, MalformedInputException { // maybe 
> overridden
>        return b2cMap[inByte + 0x80];
>    }
>
>
For ISO-8859-1 the decode is just:
   public char decode(byte inByte) throws UnmappableCharacterException, 
MalformedInputException { // maybe overridden
       return (char)(inByte + 0x80);
   }

I think also here (char)(inByte & 0xFF) should be faster, if JIT would 
see, that inByte comes out of byte[], because the masking could be saved 
completely.

-Ulf






More information about the hotspot-dev mailing list