Setup Benchmark
Mock behavior configuration (returns, matchers) — comparing TUnit.Mocks (source-generated) against runtime proxy-based mocking libraries.
Last Updated
This benchmark was automatically generated on 2026-08-14 from the latest CI run.
Environment: Ubuntu Latest • .NET SDK 10.0.400
📊 Results
Mock behavior configuration (returns, matchers):
| Library | Mean | Error | StdDev | Allocated |
|---|---|---|---|---|
| TUnit.Mocks | 423.5 ns | 2.14 ns | 2.00 ns | 2.34 KB |
| Imposter | 599.2 ns | 1.86 ns | 1.74 ns | 6.12 KB |
| Mockolate | 256.9 ns | 1.13 ns | 1.00 ns | 1.41 KB |
| Moq | 235,541.7 ns | 949.89 ns | 888.52 ns | 28.56 KB |
| NSubstitute | 4,617.9 ns | 34.57 ns | 32.34 ns | 9.06 KB |
| FakeItEasy | 5,429.5 ns | 19.18 ns | 17.94 ns | 10.45 KB |
Multiple
| Library | Mean | Error | StdDev | Allocated |
|---|---|---|---|---|
| TUnit.Mocks | 637.3 ns | 2.26 ns | 2.11 ns | 3.15 KB |
| Imposter | 1,075.7 ns | 7.03 ns | 6.24 ns | 10.59 KB |
| Mockolate | 439.5 ns | 2.62 ns | 2.45 ns | 2.35 KB |
| Moq | 68,467.0 ns | 280.75 ns | 234.44 ns | 16.53 KB |
| NSubstitute | 8,887.1 ns | 39.55 ns | 36.99 ns | 20.31 KB |
| FakeItEasy | 5,190.4 ns | 27.32 ns | 24.22 ns | 11.71 KB |
🎯 Key Insights
This benchmark compares TUnit.Mocks (source-generated) against runtime proxy-based mocking libraries for mock behavior configuration (returns, matchers).
Methodology
View the mock benchmarks overview for methodology details and environment information.
Last generated: 2026-08-14T03:10:39.371Z