简体   繁体   English

.NET / C#-什么是最佳选择而不是ActionBlock <T> (或渠道 <T> )的速度?

[英].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 PC queue and definitely does what I'm looking for. corefxlab有一个叫做Channel的东西,它是异步PC队列的非常好的实现,并且确实可以满足我的需求。 I'm curious if there's an implementation that ultimately had a similar API to ActionBlock<T> : 我很好奇是否有一个最终实现与ActionBlock<T>类似的API的实现:

  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. Channel<T>BufferBlock<T>快得多,但是我只是好奇,如果给出特定的要求,是否有更快的速度。

According to a readme by Stephen Toub, Channels might end up being the underlying implementation around some Dataflow blocks. 根据Stephen Toub的自述文件,通道可能最终成为围绕某些Dataflow块的基础实现。 Channels wins for PC queue async speed. 通道以PC队列异步速度获胜。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM