You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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.
The text was updated successfully, but these errors were encountered:
What are the considerations for result accuracy here? Can we just funnel asyncawait through NBench as is or do we need to take care of some diagnostic issues that would arise?
I've just been caught out by this, as there's no obvious indication as to what is happening, other than the runner exiting before all your test code has executed. Any chance this can be introduced in the next release, or could the library possibly detect the use of async/await?
Currently I have to write:
What I'd like to write:
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.
The text was updated successfully, but these errors were encountered: