Search code examples
asynchronoustaskproducer-consumer

.NET/C# - What is the best option instead of an ActionBlock<T> (or Channel<T>) for speed?


corefxlab has something called a Channel which is a really nice implementation of an async P-C queue and definitely does what I'm looking for. I'm curious if there's an implementation that ultimately had a similar API to ActionBlock<T>:

  1. Must be able to accept/deny from multiple producers.
  2. Only needs to have one consuming task but would be preferable that it continue processing until empty. Then 'wait' for new items.

A Channel<T> is much faster than an BufferBlock<T> but I'm just curious if given the specific requirements if there was something even faster.


Solution

  • According to a readme by Stephen Toub, Channels might end up being the underlying implementation around some Dataflow blocks. Channels wins for P-C queue async speed.