This page should be updated with each release. This benchmark was made with 2021.6.0.
Minimal overhead
This benchmark shows the minimal overhead needed to delegate the work to background threads.
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.203
[Host] : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
DefaultJob : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
Method | Mean | Error | StdDev | Ratio | RatioSD |
---|---|---|---|---|---|
SingleThread | 879.3 μs | 17.54 μs | 39.60 μs | 1.00 | 0.00 |
ThreadPool | 1,951.7 μs | 35.41 μs | 33.12 μs | 2.12 | 0.11 |
TaskRun | 2,100.1 μs | 35.64 μs | 33.33 μs | 2.28 | 0.12 |
Sequential overhead
This compares sequential execution - which is the worst case scenario for the framework - of simple single thread execution with the agent framework. Duration -1 means using Thread.SpinWait(15)
and 1 means using Thread.Sleep(1)
.
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.203
[Host] : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
DefaultJob : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
Method | Duration | Mean | Error | StdDev | Ratio | RatioSD |
---|---|---|---|---|---|---|
SingleThread | -1 | 695.8 μs | 12.29 μs | 18.02 μs | 1.00 | 0.00 |
AgentFramework | -1 | 2,525.7 μs | 34.86 μs | 29.11 μs | 3.59 | 0.09 |
AgentFrameworkReusingMessage | -1 | 1,776.0 μs | 21.11 μs | 16.48 μs | 2.52 | 0.06 |
SingleThread | 1 | 2,001,126.8 μs | 3,253.75 μs | 2,540.31 μs | 1.00 | 0.00 |
AgentFramework | 1 | 1,996,151.6 μs | 2,506.85 μs | 2,344.91 μs | 1.00 | 0.00 |
AgentFrameworkReusingMessage | 1 | 1,998,115.7 μs | 2,298.14 μs | 2,149.69 μs | 1.00 | 0.00 |
Logging overhead
This benchmark shows the sequential overhead when logging is enabled. To make it fair the comparison also logs each cycle in the single thread case. Duration -1 means using Thread.SpinWait(15)
and 1 means using Thread.Sleep(1)
.
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.203
[Host] : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
DefaultJob : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
Method | Duration | Mean | Error | StdDev | Ratio | RatioSD |
---|---|---|---|---|---|---|
SingleThread | -1 | 2.084 ms | 0.0406 ms | 0.0417 ms | 1.00 | 0.00 |
AgentFramework | -1 | 31.059 ms | 0.7493 ms | 2.1619 ms | 14.12 | 1.01 |
SingleThread | 1 | 2,001.834 ms | 6.6619 ms | 5.2012 ms | 1.00 | 0.00 |
AgentFramework | 1 | 2,004.502 ms | 12.5968 ms | 11.1667 ms | 1.00 | 0.01 |
Parallel execution
This benchmark executes 2000 workloads parallel. It compares the agent framework with Parallel.ForEach
- which should be the gold standard - and sequential execution.
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.203
[Host] : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
DefaultJob : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
Method | Mean | Error | StdDev | Median | Ratio |
---|---|---|---|---|---|
SingleThread | 11,437.8 ms | 44.23 ms | 41.37 ms | 11,440.4 ms | 1.00 |
ParallelForEach | 493.3 ms | 70.48 ms | 201.09 ms | 414.6 ms | 0.07 |
AgentFramework | 425.5 ms | 25.89 ms | 73.45 ms | 420.7 ms | 0.05 |
File Manipulation
This is more of a real life scenario. 2000 files are scanned from which 400 files are manipulated. Again the agent framework is compared to Parallel.ForEach
and sequential execution and a combination of the agent framework with Parallel.ForEach
.
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.203
[Host] : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
DefaultJob : .NET Core 3.1.15 (CoreCLR 4.700.21.21202, CoreFX 4.700.21.21402), X64 RyuJIT
Method | Mean | Error | StdDev | Median | Ratio | RatioSD |
---|---|---|---|---|---|---|
SingleThread | 308.78 ms | 6.080 ms | 12.419 ms | 308.97 ms | 1.00 | 0.00 |
ParallelForEach | 88.10 ms | 2.270 ms | 6.586 ms | 87.23 ms | 0.28 | 0.03 |
AgentFramework | 112.81 ms | 2.235 ms | 6.042 ms | 112.91 ms | 0.37 | 0.02 |
AgentFrameworkParallelForEach | 90.47 ms | 2.852 ms | 8.136 ms | 87.67 ms | 0.29 | 0.03 |