Swap should be better done native?
Martin Buchholz
martinrb at google.com
Tue Mar 30 17:59:55 PDT 2010
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/
Please study ByteArrayAccess.java and SwapMicroBenchmark.java
Can you measure a performance improvement from my change?
> 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.
Probably hotspot can optimize it away, but why not help?
Martin
More information about the nio-discuss
mailing list