Skip to main content

Invocation Benchmark

Calling methods on mock objects — comparing TUnit.Mocks (source-generated) against runtime proxy-based mocking libraries.

Last Updated

This benchmark was automatically generated on 2026-11-12 from the latest CI run.

Environment: Ubuntu Latest • .NET SDK 11.0.100

📊 Results​

Calling methods on mock objects:

LibraryMeanErrorStdDevAllocated
TUnit.Mocks331.57 ns366.08 ns20.066 ns128 B
Imposter86.76 ns22.36 ns1.226 ns48 B
Mockolate116.39 ns52.23 ns2.863 ns84 B
Moq900.01 ns475.61 ns26.070 ns376 B
NSubstitute843.79 ns253.17 ns13.877 ns360 B
FakeItEasy1,991.85 ns952.96 ns52.235 ns960 B

String​

LibraryMeanErrorStdDevAllocated
TUnit.Mocks197.72 ns293.04 ns16.063 ns96 B
Imposter81.72 ns26.61 ns1.459 ns48 B
Mockolate107.60 ns40.21 ns2.204 ns60 B
Moq614.21 ns333.28 ns18.268 ns296 B
NSubstitute676.13 ns158.76 ns8.702 ns272 B
FakeItEasy1,693.80 ns691.18 ns37.886 ns800 B

100 calls​

LibraryMeanErrorStdDevAllocated
TUnit.Mocks30,601.72 ns35,263.05 ns1,932.887 ns12736 B
Imposter8,052.79 ns6,946.33 ns380.752 ns4800 B
Mockolate11,651.27 ns7,231.21 ns396.367 ns8400 B
Moq88,012.05 ns17,191.96 ns942.349 ns37600 B
NSubstitute82,398.20 ns13,759.41 ns754.200 ns36448 B
FakeItEasy196,044.94 ns19,945.01 ns1,093.253 ns96000 B

🎯 Key Insights​

This benchmark compares TUnit.Mocks (source-generated) against runtime proxy-based mocking libraries for calling methods on mock objects.


Methodology

View the mock benchmarks overview for methodology details and environment information.

Last generated: 2026-11-12T02:21:42.541Z