4 ms·
Good question. BlockingCollection is actually a wrapper around a ConcurrentQueue. It provides some nice things like....blocking so the queue can be used in a pr
by algorithmsRcool 8y ago
Good question. BlockingCollection is actually a wrapper around a ConcurrentQueue. It provides some nice things like....blocking so the queue can be used in a producer/consumer manner.
Channels does this but has 2 advantages.
1. It is built on the most up-to-date threading primatives (ValueTask) which gives it a perf advantage.
2. It's internal design is very simple and lightweight. BlockingCollection was designed to have swappable guts. Channels are single purpose.
The other nice thing is the channels API is really no nonsense super simple to get GREAT performance out of normal async/await. No tuning really needed. I got >300Krps out of a sequence of chained channels with a buffer size of 1.