StephenCleary / AsyncEx

A helper library for async/await.
MIT License
3.51k stars 358 forks source link

Comparison with AysncProducerConsumerQueue and System.Threading.Channels #195

Closed bboyle1234 closed 4 years ago

bboyle1234 commented 5 years ago

Hi Stephen, What are your thoughts about when a developer should choose to use one or the other of the above-mentioned utilities? (If you think this is a good question maybe you'd wanna answer it in stack-overflow)

StephenCleary commented 4 years ago

I recommend System.Threading.Channels if your producers and consumers are asynchronous; Channels are an official Microsoft solution and are much more performant.

If you need mixed async/sync, then the answer is a bit less clear since Channels have an async-only API so you'd need to block if producing/consuming synchronously, and it's not documented whether direct blocking is appropriate for all channel implementations.