Makes sense - If your queues are exceeding 624 elements, you've got bigger problems to worry about.
Chad ----- Original Message ----- From: "Berin Loritsch" <[EMAIL PROTECTED]> To: "Avalon Developers List" <avalon-dev@jakarta.apache.org> Sent: Wednesday, December 19, 2001 1:56 PM Subject: Re: [Report] Efficiencies of FixedSize and Default Queues > Chad Stansbury wrote: > > > Your results piqued my interest. I have created a test program to determine > > at which point the linked list becomes more efficient than the array list. > > Here are my results: > > > > List Size = 16 elements > > Iterations = 1,000,000 > > ArrayList = 331 ms > > LinkedList = 761 ms > > > > List Size = 32 elements > > Iterations = 1,000,000 > > ArrayList = 391 ms > > LinkedList = 761 ms > > > > List Size = 64 elements > > Iterations = 1,000,000 > > ArrayList = 460 ms > > LinkedList = 751 ms > > > > List Size = 128 elements > > Iterations = 1,000,000 > > ArrayList = 601 ms > > LinkedList = 751 ms > > > > List Size = 256 elements > > Iterations = 1,000,000 > > ArrayList = 881 ms > > LinkedList = 761 ms > > > > As you can see, the linked list's add/remove time remains constant, while > > the array list experiences linear degradation. The crossover point being > > somewhare around 200 some elements. Anyway, it was an interesting exercise. > > Below is the program I used to test this, and all results above were > > generated w/ a P4 @ 1.4GHz, 512 MB RAM. > > > I ran your test, and for my machine (arguably slower) the crossover point > was 512 elements. > > I then altered it to be more in line with how I was using the Lists before: > I added to the tail, and removed from the head. > > Both CircularBuffer and LinkedList exibited constant time access. The interesting > thing is that ArrayList is more efficient operating the way I told it to. The > crossover point was pushed back to somewhere around 624 elements. > > Armed with this knowledge, I think the CircularBuffer is the better approach, > and am not likely to implement a LinkedList version of the Queue. > > > -- > > "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]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>