Berin Loritsch wrote:

Chad Stansbury wrote:

Is there a reason you're using an ArrayList rather than a LinkedList for the
DefaultQueue? ArrayLists are great for indexing, but suck for
variable-sized lists w/ lots off adds & removes. LinkedLists, on the other
hand, excel at variable-sized lists with lots of adds/removes, but suck at
indexing. Are you using indexing?



No, I am not using indexing. I will try your suggestions, and report back.


My initial testing reveals that for small queues where the overall size is
fairly constant, the ArrayList wins out by 100 nsecs consistently.

Run five times each, the LinkedList version was a complete second behind the
ArrayList version.  I have a feeling this has to do with the way that 
LinkedLists
are constructed (i.e. many small objects that merely reference entries and the
object in question).  The overhead is minor, but why incur it if you don't
need to?



Also, for the FixedSizedQueue, you might want to consider a circular buffer,
which is already part of the Excalibur Collection classes.

What I have works, and I have a feeling that it will still be more performant than the CircularBuffer. I will throw together a CircularBuffer based Queue for test results though.

--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to