Swap should be better done native?

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


Am 01.04.2010 00:57, schrieb Martin Buchholz:
> On Wed, Mar 31, 2010 at 15:51, Ulf Zibis<Ulf.Zibis at gmx.de>  wrote:
>    
>> 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.
>>>        
> We can't do that until all the primitive types have a reverseBytes method.
>    

??? You mean, Byte should have a reverseBytes method?
All others have one.

-Ulf




More information about the nio-discuss mailing list