Swap should be better done native?

Ulf Zibis Ulf.Zibis at gmx.de
Tue Mar 30 07:39:26 PDT 2010


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?

Additionally, in current XByteBuffer implementations the term (x << 0) 
is frequently used.
Martin Buchholz has reported, that those zero-shifts reside in the byte 
code, so IMO should be refactored, as at least interpreter would be 
throttled by that.

-Ulf




More information about the nio-discuss mailing list