BenchmarkMockNet Results

January 12, 2026 · View on GitHub

Official Run: 01/12/2026

FrameworkVersion
FakeItEasy9.0.0
JustMock2025.4.1112.487
Moq4.20.72
NSubstitute5.3.0
PCLMock5.1.3
Rocks10.0.0

Construction

This test simply creates an IThing object to test using the given framework

MethodMeanErrorStdDevMedianRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Stub21.49 ns138.32 ns7.582 ns23.59 ns1.110.54--24 B1.00
FakeItEasy3,593.35 ns43,803.37 ns2,401.011 ns2,710.07 ns185.41132.120.16000.01002714 B113.08
JustMockLite18,665.15 ns86,296.99 ns4,730.229 ns16,023.18 ns963.11416.621.01000.010016905 B704.38
Moq3,389.60 ns43,891.93 ns2,405.865 ns2,762.42 ns174.90130.400.1100-1928 B80.33
NSubstitute4,283.51 ns49,827.63 ns2,731.220 ns3,788.84 ns221.03152.220.2900-5000 B208.33
PCLMock80.28 ns743.71 ns40.765 ns78.24 ns4.142.45--144 B6.00
Rocks85.59 ns627.05 ns34.371 ns87.99 ns4.422.29--128 B5.33

Return

A mock object is created, a method is setup to a return and int value, and that method is called

MethodMeanErrorStdDevMedianRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Stub20.17 ns139.97 ns7.672 ns22.40 ns1.130.61--24 B1.00
FakeItEasy5,456.52 ns65,845.32 ns3,609.204 ns4,034.27 ns306.21224.420.28000.01004768 B198.67
JustMockLite175,045.86 ns152,520.15 ns8,360.144 ns170,285.51 ns9,823.153,975.382.06002.050034512 B1,438.00
Moq6,016.94 ns77,679.15 ns4,257.856 ns4,399.64 ns337.66259.670.2200-3704 B154.33
NSubstitute5,751.69 ns80,943.24 ns4,436.772 ns3,204.35 ns322.77264.650.43000.01007280 B303.33
PCLMock4,146.55 ns16,125.52 ns883.894 ns4,655.18 ns232.69104.270.1100-1841 B76.71
Rocks230.06 ns1,035.11 ns56.738 ns216.29 ns12.915.970.0100-296 B12.33

EmptyReturn

A mock object is created, with no method setup, and an method returning an int is called

MethodMeanErrorStdDevMedianRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Stub19.83 ns135.49 ns7.426 ns22.22 ns1.130.60--24 B1.00
FakeItEasy4,316.82 ns52,552.66 ns2,880.589 ns3,414.27 ns245.65180.460.21000.01003587 B149.46
JustMockLite25,067.30 ns158,019.49 ns8,661.582 ns20,087.29 ns1,426.49728.431.21000.130020340 B847.50
Moq4,054.16 ns55,854.29 ns3,061.562 ns3,123.85 ns230.71185.510.1300-2232 B93.00
NSubstitute4,786.88 ns68,645.10 ns3,762.670 ns2,819.85 ns272.40225.830.3400-5696 B237.33
PCLMock4,196.68 ns16,997.38 ns931.684 ns4,717.15 ns238.82107.010.1100-1840 B76.67
Rocks274.37 ns903.24 ns49.510 ns272.05 ns15.616.740.0100-296 B12.33

EmptyMethod

A mock object is created, with no method setup, and a method with no return value is called

MethodMeanErrorStdDevMedianRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Stub20.61 ns145.47 ns7.973 ns23.00 ns1.140.62--24 B1.00
FakeItEasy3,768.86 ns52,319.64 ns2,867.816 ns2,212.00 ns208.21170.410.21000.01003562 B148.42
JustMockLite25,349.78 ns161,795.32 ns8,868.547 ns20,270.98 ns1,400.47735.221.20000.130020228 B842.83
Moq3,124.05 ns44,869.64 ns2,459.456 ns1,875.75 ns172.59144.920.1300-2208 B92.00
NSubstitute5,516.25 ns76,864.06 ns4,213.179 ns3,749.82 ns304.75250.110.3400-5696 B237.33
PCLMock4,456.32 ns7,878.98 ns431.874 ns4,548.63 ns246.19103.880.1000-1832 B76.33
Rocks203.02 ns722.59 ns39.607 ns195.15 ns11.225.050.0100-288 B12.00

OneParameter

A mock object is created, with no method setup, and a method with no return value requiring an int parameter is called

MethodMeanErrorStdDevMedianRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Stub20.46 ns140.27 ns7.689 ns22.79 ns1.130.60--24 B1.00
FakeItEasy3,891.52 ns50,889.04 ns2,789.400 ns2,436.65 ns214.66165.970.21000.01003700 B154.17
JustMockLite25,235.37 ns158,960.11 ns8,713.140 ns20,236.10 ns1,392.02710.141.23000.130020700 B862.50
Moq3,186.56 ns42,964.85 ns2,355.048 ns1,918.29 ns175.77139.020.1300-2240 B93.33
NSubstitute4,669.42 ns67,416.89 ns3,695.348 ns2,584.60 ns257.57214.590.3400-5728 B238.67
PCLMock144,182.53 ns76,048.70 ns4,168.486 ns142,728.99 ns7,953.293,171.160.62000.610010433 B434.71
Rocks393.59 ns1,195.32 ns65.520 ns394.42 ns21.719.260.0200-352 B14.67

Callback

A mock object is created, a method is setup with a callback, and that method is called

MethodMeanErrorStdDevMedianRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Stub24.89 ns145.79 ns7.991 ns28.25 ns1.090.49--24 B1.00
FakeItEasy5,492.33 ns70,803.17 ns3,880.961 ns3,674.48 ns240.60174.420.29000.01004977 B207.38
JustMockLite151,157.06 ns138,721.73 ns7,603.806 ns147,376.00 ns6,621.642,249.812.04002.030034166 B1,423.58
Moq6,100.52 ns78,576.47 ns4,307.041 ns4,349.21 ns267.24193.610.2300-3864 B161.00
NSubstitute5,387.40 ns69,316.73 ns3,799.484 ns3,222.74 ns236.00170.830.40000.01006720 B280.00
PCLMock4,697.58 ns16,504.49 ns904.667 ns5,183.29 ns205.7878.080.1200-2020 B84.17
Rocks271.79 ns994.72 ns54.524 ns261.19 ns11.914.560.0200-376 B15.67

Verify

Verifies that the method was called

MethodMeanErrorStdDevMedianRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Stub23.52 ns134.00 ns7.345 ns25.84 ns1.080.46--24 B1.00
FakeItEasy6,152.69 ns75,127.51 ns4,117.993 ns4,302.60 ns283.15193.650.31000.01005282 B220.08
JustMockLite54,350.14 ns198,241.28 ns10,866.274 ns48,328.92 ns2,501.22916.162.37000.590039701 B1,654.21
Moq5,730.38 ns79,291.73 ns4,346.247 ns3,725.30 ns263.71199.420.2200-3792 B158.00
NSubstitute5,849.46 ns70,546.37 ns3,866.884 ns3,636.01 ns269.19182.340.4300-7208 B300.33
PCLMock4,835.97 ns51,323.25 ns2,813.201 ns5,743.62 ns222.55136.860.1500-2560 B106.67
Rocks723.61 ns1,187.09 ns65.068 ns700.01 ns33.3010.950.0300-600 B25.00