Open
Description
Currently I have to write:
[PerfBenchmark(
Description =
"Measures the throughput of Akka.Remote over a particular transport using one-way messaging",
RunMode = RunMode.Iterations, NumberOfIterations = 3, TestMode = TestMode.Measurement,
RunTimeMilliseconds = 1000)]
[CounterMeasurement(RemoteMessageCounterName)]
[GcMeasurement(GcMetric.TotalCollections, GcGeneration.AllGc)]
public void PingPong(BenchmarkContext context)
{
_receivers.ForEach(c =>
{
c.Tell("hit");
});
var waiting = Task.WhenAll(_tasks);
SpinWait.SpinUntil(() => waiting.IsCompleted); // TODO: would get more accurate results if we could AWAIT and not block here.
}
What I'd like to write:
[PerfBenchmark(
Description =
"Measures the throughput of Akka.Remote over a particular transport using one-way messaging",
RunMode = RunMode.Iterations, NumberOfIterations = 3, TestMode = TestMode.Measurement,
RunTimeMilliseconds = 1000)]
[CounterMeasurement(RemoteMessageCounterName)]
[GcMeasurement(GcMetric.TotalCollections, GcGeneration.AllGc)]
public async Task PingPong(BenchmarkContext context)
{
_receivers.ForEach(c =>
{
c.Tell("hit");
});
await Task.WhenAll(_tasks);
}
Right now I'm skewing the benchmark by hogging the main thread while waiting for the background ones to finish execution. Would make for clearer results if I could do this in a non-blocking fashion and not compete for the low core-count VMs we run these benchmarks on over at Akka.NET.