Skip to content

Latest commit

 

History

History
111 lines (87 loc) · 9.93 KB

File metadata and controls

111 lines (87 loc) · 9.93 KB

BenchmarkMockNet Results

Official Run: 07/10/2026

Framework Version
FakeItEasy 9.0.1
JustMock 2026.2.519.512
Moq 4.20.72
NSubstitute 5.3.0
PCLMock 5.1.3
Rocks 10.3.0

Construction

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

Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 24.91 ns 193.74 ns 10.62 ns 1.17 0.71 - - 24 B 1.00
FakeItEasy 3,949.41 ns 40,065.73 ns 2,196.14 ns 185.99 129.29 0.1600 0.0100 2714 B 113.08
JustMockLite 18,260.99 ns 75,909.48 ns 4,160.85 ns 859.99 433.84 1.0100 0.0100 16905 B 704.38
Moq 3,401.96 ns 42,198.81 ns 2,313.06 ns 160.21 126.08 0.1100 - 1928 B 80.33
NSubstitute 3,999.38 ns 48,649.84 ns 2,666.66 ns 188.35 146.32 0.2900 - 5000 B 208.33
PCLMock 87.54 ns 949.19 ns 52.03 ns 4.12 2.98 - - 144 B 6.00
Rocks 86.80 ns 773.94 ns 42.42 ns 4.09 2.65 - - 120 B 5.00

Return

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

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 24.27 ns 203.84 ns 11.17 ns 25.97 ns 1.20 0.78 - - 24 B 1.00
FakeItEasy 6,126.42 ns 70,170.12 ns 3,846.26 ns 5,123.76 ns 303.28 233.36 0.2800 0.0100 4768 B 198.67
JustMockLite 185,603.72 ns 177,365.95 ns 9,722.03 ns 180,112.05 ns 9,188.01 4,475.47 2.0600 2.0500 34512 B 1,438.00
Moq 6,081.04 ns 72,499.00 ns 3,973.91 ns 5,223.67 ns 301.03 237.40 0.2200 - 3704 B 154.33
NSubstitute 5,982.94 ns 84,077.57 ns 4,608.58 ns 3,466.78 ns 296.18 260.34 0.4300 0.0100 7280 B 303.33
PCLMock 4,053.49 ns 11,402.19 ns 624.99 ns 4,197.92 ns 200.66 101.59 0.1100 - 1867 B 77.79
Rocks 185.68 ns 1,205.19 ns 66.06 ns 175.85 ns 9.19 5.43 0.0100 - 240 B 10.00

EmptyReturn

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

Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 23.83 ns 209.71 ns 11.50 ns 1.23 0.86 - - 24 B 1.00
FakeItEasy 4,307.35 ns 50,351.82 ns 2,759.95 ns 222.97 180.55 0.2100 0.0100 3587 B 149.46
JustMockLite 23,732.40 ns 149,869.19 ns 8,214.84 ns 1,228.52 761.95 1.2100 0.1300 20340 B 847.50
Moq 4,221.16 ns 49,897.54 ns 2,735.05 ns 218.51 178.09 0.1300 - 2232 B 93.00
NSubstitute 5,589.35 ns 65,548.23 ns 3,592.92 ns 289.34 234.72 0.3400 - 5696 B 237.33
PCLMock 3,887.37 ns 14,770.73 ns 809.63 ns 201.23 112.66 0.1100 - 1872 B 78.00
Rocks 185.79 ns 1,235.74 ns 67.73 ns 9.62 6.06 0.0100 - 240 B 10.00

EmptyMethod

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

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 24.17 ns 199.37 ns 10.93 ns 26.51 ns 1.20 0.78 - - 24 B 1.00
FakeItEasy 4,323.22 ns 50,347.60 ns 2,759.72 ns 3,547.93 ns 214.63 167.33 0.2100 0.0100 3562 B 148.42
JustMockLite 23,484.93 ns 145,769.72 ns 7,990.13 ns 18,954.70 ns 1,165.93 682.65 1.2000 0.1300 20228 B 842.83
Moq 3,575.30 ns 45,380.86 ns 2,487.48 ns 2,936.38 ns 177.50 146.09 0.1300 - 2208 B 92.00
NSubstitute 5,265.64 ns 63,574.31 ns 3,484.72 ns 3,279.59 ns 261.42 208.40 0.3400 - 5696 B 237.33
PCLMock 3,703.80 ns 17,081.47 ns 936.29 ns 4,242.94 ns 183.88 99.99 0.1000 - 1825 B 76.04
Rocks 165.64 ns 1,182.74 ns 64.83 ns 156.41 ns 8.22 5.05 0.0100 - 232 B 9.67

OneParameter

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

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 24.21 ns 201.73 ns 11.06 ns 26.63 ns 1.21 0.80 - - 24 B 1.00
FakeItEasy 4,351.38 ns 50,410.26 ns 2,763.16 ns 3,448.34 ns 216.73 169.68 0.2100 0.0100 3700 B 154.17
JustMockLite 23,842.39 ns 159,801.54 ns 8,759.26 ns 18,787.34 ns 1,187.50 720.35 1.2300 0.1300 20700 B 862.50
Moq 3,903.92 ns 44,456.57 ns 2,436.81 ns 3,986.37 ns 194.44 150.68 0.1300 - 2240 B 93.33
NSubstitute 5,619.18 ns 70,195.51 ns 3,847.65 ns 4,557.13 ns 279.87 229.57 0.3400 - 5728 B 238.67
PCLMock 135,082.21 ns 96,147.80 ns 5,270.19 ns 132,329.40 ns 6,727.91 3,337.78 0.6200 0.6100 10433 B 434.71
Rocks 303.55 ns 1,326.93 ns 72.73 ns 292.67 ns 15.12 8.24 0.0200 - 360 B 15.00

Callback

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

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 27.82 ns 223.78 ns 12.27 ns 29.42 ns 1.18 0.72 - - 24 B 1.00
FakeItEasy 6,183.09 ns 73,246.42 ns 4,014.88 ns 5,073.68 ns 261.54 199.13 0.2900 0.0100 4977 B 207.38
JustMockLite 153,131.09 ns 181,300.41 ns 9,937.69 ns 147,760.52 ns 6,477.26 2,963.89 2.0400 2.0300 34166 B 1,423.58
Moq 5,971.38 ns 71,339.20 ns 3,910.34 ns 4,758.68 ns 252.58 193.36 0.2300 - 3864 B 161.00
NSubstitute 6,193.47 ns 86,220.29 ns 4,726.03 ns 3,889.05 ns 261.98 222.63 0.4000 0.0100 6720 B 280.00
PCLMock 4,311.54 ns 13,554.84 ns 742.99 ns 4,698.60 ns 182.37 87.84 0.1200 - 2036 B 84.83
Rocks 215.54 ns 985.76 ns 54.03 ns 195.11 ns 9.12 4.66 0.0100 - 320 B 13.33

Verify

Verifies that the method was called

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 28.90 ns 219.41 ns 12.03 ns 31.09 ns 1.16 0.67 - - 24 B 1.00
FakeItEasy 6,250.31 ns 72,295.22 ns 3,962.74 ns 4,803.93 ns 250.25 183.60 0.3100 0.0100 5282 B 220.08
JustMockLite 47,194.28 ns 199,647.06 ns 10,943.33 ns 41,149.57 ns 1,889.58 913.59 2.3700 0.5900 39701 B 1,654.21
Moq 5,620.68 ns 79,231.98 ns 4,342.97 ns 3,596.50 ns 225.04 189.47 0.2200 - 3792 B 158.00
NSubstitute 6,294.93 ns 83,040.45 ns 4,551.73 ns 3,742.31 ns 252.04 202.25 0.4300 - 7208 B 300.33
PCLMock 4,657.02 ns 42,770.98 ns 2,344.42 ns 5,301.33 ns 186.46 119.15 0.1500 - 2560 B 106.67
Rocks 526.25 ns 1,488.62 ns 81.60 ns 531.21 ns 21.07 9.60 0.0300 - 576 B 24.00