On Jan 3, 2011, at 4:31 PM, Matt L. Miller wrote:
> It boggles my
> mind that any structure that (I assume) uses arrays to back it is
> than direct access to an array; how often does that happen?
I'm guessing it's a memory fence issue on compiling of some sort. At
any rate, it appears that if you have an array as an instance variable
in YOUR class, then accessing it in a method is faster
than someone externally accessing it even if it's public. At least in
Java 1.6, HotSpot, OS X. Anyway, seriously, in the goofy little
microbenchmarks I've written that's exactly what I'm seeing.
ArrayList can now sometimes be faster than accessing Bag's array