>
> On Feb 20, 5:15 am, Rémi Forax <fo...@univ-mlv.fr> wrote:
>> I don't know if there is another method but you can improve the
>> following code,
>> remove the two asInBuffer() because they allocate a new Java object
>> and use getInt()/putInt() instead of get()/put().
> I take the point and I think this will give me a little boost. I'll
> post the
> profile soon.
Bill's reply allured to this -- if the ByteBuffers hasArray(), you can
access the underlying backing arrays via array().
Directly accessing the arrays avoids the bounds checking of get/put.
Don't forget to take arrayOffset() into account.
--
Philip Jenvey
The JVM still does array bounds checks, of course.
> --
> Philip Jenvey
Randall Schulz
>> Directly accessing the arrays avoids the bounds checking of get/put.
>
> The JVM still does array bounds checks, of course.
Unless they are optimized away by the JIT.
--
GMail doesn't have rotating .sigs, but you can see mine at
http://www.ccil.org/~cowan/signatures
> On Sat, Feb 28, 2009 at 5:52 PM, Randall R Schulz
> <rsc...@sonic.net> wrote:
>
>>> Directly accessing the arrays avoids the bounds checking of get/put.
>>
>> The JVM still does array bounds checks, of course.
>
> Unless they are optimized away by the JIT.
Which happens when...
I started to reply to this, as far as HotSpot is concerned, and moved
my reply here:
http://wikis.sun.com/display/HotSpotInternals/RangeCheckElimination
Enjoy!
-- John
Thank you for that.
Which versions of JVM include this optimization?
> Enjoy!
>
> -- John
Randall Schulz