Hi folks,
`LinkedList` is used as the underlying data-structure for all core.async
buffers. However, looking closer reveals that what is really needed is a
`Deque` (for its .addFirst/.removeLast methods). So naturally then it
begs the question - why not `ArrayDeque` [1]? It should offer superior
insertion/removal/traversing performance, and in the context of
core.async it will never be resized (if initialised with `n`).
And since we're on the subject, why not even go crazy with a
(thread-safe) `ConcurrentLinkedDeque` [2] ? Leaving the counting
complication aside for a moment (something which I wouldn't mind
feedback on), having a thread-safe buffer opens up the door to safe
buffer snapshots.
Anything wrong with either of those approaches? Many thanks in advance...
Kind regards,
Dimitris
[1]:
https://github.com/jimpil/asynctopia/blob/master/src/asynctopia/buffers/array.clj
[2]:
https://github.com/jimpil/asynctopia/blob/master/src/asynctopia/buffers/thread_safe.clj