MASON-INTEREST-L Archives

January 2011

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Mon, 3 Jan 2011 18:01:20 -0500
MIME-version:
1.0 (Apple Message framework v936)
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Content-type:
text/plain; charset=US-ASCII; format=flowed; delsp=yes
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Content-transfer-encoding:
7bit
Parts/Attachments:
text/plain (18 lines)
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  
> faster
> 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  
directly.

Sean

ATOM RSS1 RSS2