Chad Stansbury wrote:
Makes sense - If your queues are exceeding 624 elements, you've got bigger
problems to worry about.
:)
For the interested, the results for my test runs with the three list types
folow:
Test method: add to head, remove from tail
Iterations: 1,000,000
Size ArrayList LinkedList CircularBuffer
---- --------- ---------- --------------
16 540 1443 360
32 580 1402 321
64 640 1392 331
128 761 1442 340
256 1011 1392 311
512 1502 1443 310
Test method: add to tail, remove from head
Iterations: 1,000,000
Size ArrayList LinkedList CircularBuffer
---- --------- ---------- --------------
512 1482 1562 341
1024 2423 1593 340
624 1672 1512 311
What is interesting to note is that ArrayList favors adding to the tail and
removing from the head. LinkedList favors adding to the head and removing
from the tail.
It is not fair to compare CircularBuffer to the Lists because it's purpose
is different from a List. Therefore, the only method of adding and removing
is optimal to the CircularBuffer.
It is encouraging that not only does the CircularBuffer exhibit a constant
access time, but it is also far more efficient than ArrayList!
I would like to clean up the API a little bit, though with more standard
add() and remove() methods as opposed to append() and get().
--
"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]>