You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of Chan and Port use a very simple strategy based on an atomic linked list. The implementation is alluringly simple but it requires an allocation on every send and benchmark profiles show these allocations at the top.
Google turns up http://www.cs.tau.ac.il/~adamx/ppopp2013-x86queues.pdf ("Fast Concurrent Queues for x86 Processors" Morrison & Afek 2013), and that seems to suggest there aren't [m]any other array-based unbounded concurrent queues.
Closing. I've implemented an unbounded queue for Chan types which amortized doesn't perform allocations. We'd still need to do some work on SharedChan, but it's clear that avoiding allocations is a huge win here.
Activity
huonw commentedon Aug 18, 2013
I'd guess that (an atomic version of)
extra::ringbuf
would be a way to handle this.huonw commentedon Aug 30, 2013
Google turns up http://www.cs.tau.ac.il/~adamx/ppopp2013-x86queues.pdf ("Fast Concurrent Queues for x86 Processors" Morrison & Afek 2013), and that seems to suggest there aren't [m]any other array-based unbounded concurrent queues.
brson commentedon Oct 26, 2013
We could also experiment with the queue added in #9710. It is surely faster than the existing channels.
alexcrichton commentedon Dec 17, 2013
Closing. I've implemented an unbounded queue for
Chan
types which amortized doesn't perform allocations. We'd still need to do some work onSharedChan
, but it's clear that avoiding allocations is a huge win here.