Open utterances-bot opened 1 year ago
I think it would be interesting to compare with the Dataflow library: https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/dataflow-task-parallel-library
What's wrong with this PLINQ solution?
await InstrumentedRun("PLinq @ 4", async () => {
var tasks = workload.AsParallel()
.WithDegreeOfParallelism(4)
.Select(item => Task.Delay(item.Delay));
await Task.WhenAll(tasks);
});
@thriolsson Michael Shpilt has comparisons of TPL Dataflow, Channels, Rx, and a couple of built in primitives showing TPL Dataflow performing just a bit slower than Channels. But TPL Dataflow covers different constructs.
@sonnemaf Nothing wrong with it, but that like Parallel.For
, it is "throttled" by the 4 parallel tasks whereas the Channel
has no such constraint so every task runs to blocking and is more "efficient" if your task is heavily I/O bound and you don't have upstream constraints.
Very good research, but how about stack allocation difference?
@chrlschn - .NET Task Parallel Library vs System.Threading.Channels
Wondering which concurrency library is right for you? Let's dive in!
https://chrlschn.dev/blog/2023/10/dotnet-task-parallel-library-vs-system-threading-channels/