The producer can actually come in on different threads (because lastInserted is volatile), but can/will lose items if they arrive concurrently. Take only supports a single client.
This runs like crazy, but is not the most garbage friendly around.
TwoThreadBlockingQueue insert 5000000 elements in = 52ms LinkedBlockingQueue insert 5000000 elements in = 179ms LikedBlockingDeque insert 5000000 elements in = 114ms ArrayList insert 5000000 elements in = 18ms (sized at correct size from start) @author Kristian Rosenvold
|
|