Swap should be better done native?

Ulf Zibis Ulf.Zibis at gmx.de
Wed Mar 31 14:05:06 PDT 2010


Am 31.03.2010 02:59, schrieb Martin Buchholz:
> On Tue, Mar 30, 2010 at 07:39, Ulf Zibis<Ulf.Zibis at gmx.de>  wrote:
>    
>> In java.nio.Bits, there are several swap methods.
>>      
>    
>> Shouldn't this be done better by a native method, as popular CPU's IMO would
>> do that faster, and HotSpot easily could inline the single instruction?
>>      
> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/nioBits.java/
>    

Additionally you could inline Integer/Long.reverseBytes directly to 
java.nio.Direct-X-Buffer.java.template and 
java.nio.Direct-X-Buffer-bin.java.template.

-Ulf




More information about the nio-discuss mailing list