Swap should be better done native?

Ulf Zibis Ulf.Zibis at gmx.de
Wed Mar 31 16:11:32 PDT 2010


Am 31.03.2010 23:05, schrieb Ulf Zibis:
> 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.

Not to forget java.nio.Heap-X-Buffer.java.template.

-Ulf




More information about the nio-discuss mailing list