Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create benchmarks for System.Threading.Tasks.Dataflow #951

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Reactive Dataflow perf tests
  • Loading branch information
manandre committed Oct 17, 2019
commit 432afcf71225d78f1de65f28d58830291e11ecaa
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,31 @@ public override ITargetBlock<int> CreateBlock() =>
);
}


// public class BufferedActionBlockPerfTests : DefaultTargetPerfTests
// {
// public override ITargetBlock<int> CreateBlock()
// {
// var buffer = new BufferBlock<int>();
// var action = new ActionBlock<int>(i => { });
// buffer.LinkTo(action, new DataflowLinkOptions { PropagateCompletion = true });
// return DataflowBlock.Encapsulate(action, buffer);
// }
// }

[BenchmarkCategory(Categories.CoreFX)]
public class TransformBlockPerfTests : DefaultPropagatorPerfTests
{
public override IPropagatorBlock<int, int> CreateBlock() =>
new TransformBlock<int, int>(i => i);

[Benchmark(OperationsPerInvoke = 100_000)]
public void RxPublishSubscribe()
{
var observer = block.AsObserver();
var observable = block.AsObservable();
observable.Subscribe(new IgnoreObserver<int>());
for(int i = 0; i < 100_000; i++)
{
observer.OnNext(i);
}
observer.OnCompleted();
}

class IgnoreObserver<T> : IObserver<T>
{
public void OnCompleted() {}
public void OnError(Exception error) {}
public void OnNext(T value) {}
}
}

public class ParallelTransformBlockPerfTests : DefaultPropagatorPerfTests
Expand Down