Skip to content

Latest commit

 

History

History
111 lines (87 loc) · 10.3 KB

File metadata and controls

111 lines (87 loc) · 10.3 KB

BenchmarkMockNet Results

Official Run: 01/12/2026

Framework Version
FakeItEasy 9.0.0
JustMock 2025.4.1112.487
Moq 4.20.72
NSubstitute 5.3.0
PCLMock 5.1.3
Rocks 10.0.0

Construction

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

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 21.49 ns 138.32 ns 7.582 ns 23.59 ns 1.11 0.54 - - 24 B 1.00
FakeItEasy 3,593.35 ns 43,803.37 ns 2,401.011 ns 2,710.07 ns 185.41 132.12 0.1600 0.0100 2714 B 113.08
JustMockLite 18,665.15 ns 86,296.99 ns 4,730.229 ns 16,023.18 ns 963.11 416.62 1.0100 0.0100 16905 B 704.38
Moq 3,389.60 ns 43,891.93 ns 2,405.865 ns 2,762.42 ns 174.90 130.40 0.1100 - 1928 B 80.33
NSubstitute 4,283.51 ns 49,827.63 ns 2,731.220 ns 3,788.84 ns 221.03 152.22 0.2900 - 5000 B 208.33
PCLMock 80.28 ns 743.71 ns 40.765 ns 78.24 ns 4.14 2.45 - - 144 B 6.00
Rocks 85.59 ns 627.05 ns 34.371 ns 87.99 ns 4.42 2.29 - - 128 B 5.33

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 20.17 ns 139.97 ns 7.672 ns 22.40 ns 1.13 0.61 - - 24 B 1.00
FakeItEasy 5,456.52 ns 65,845.32 ns 3,609.204 ns 4,034.27 ns 306.21 224.42 0.2800 0.0100 4768 B 198.67
JustMockLite 175,045.86 ns 152,520.15 ns 8,360.144 ns 170,285.51 ns 9,823.15 3,975.38 2.0600 2.0500 34512 B 1,438.00
Moq 6,016.94 ns 77,679.15 ns 4,257.856 ns 4,399.64 ns 337.66 259.67 0.2200 - 3704 B 154.33
NSubstitute 5,751.69 ns 80,943.24 ns 4,436.772 ns 3,204.35 ns 322.77 264.65 0.4300 0.0100 7280 B 303.33
PCLMock 4,146.55 ns 16,125.52 ns 883.894 ns 4,655.18 ns 232.69 104.27 0.1100 - 1841 B 76.71
Rocks 230.06 ns 1,035.11 ns 56.738 ns 216.29 ns 12.91 5.97 0.0100 - 296 B 12.33

EmptyReturn

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

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 19.83 ns 135.49 ns 7.426 ns 22.22 ns 1.13 0.60 - - 24 B 1.00
FakeItEasy 4,316.82 ns 52,552.66 ns 2,880.589 ns 3,414.27 ns 245.65 180.46 0.2100 0.0100 3587 B 149.46
JustMockLite 25,067.30 ns 158,019.49 ns 8,661.582 ns 20,087.29 ns 1,426.49 728.43 1.2100 0.1300 20340 B 847.50
Moq 4,054.16 ns 55,854.29 ns 3,061.562 ns 3,123.85 ns 230.71 185.51 0.1300 - 2232 B 93.00
NSubstitute 4,786.88 ns 68,645.10 ns 3,762.670 ns 2,819.85 ns 272.40 225.83 0.3400 - 5696 B 237.33
PCLMock 4,196.68 ns 16,997.38 ns 931.684 ns 4,717.15 ns 238.82 107.01 0.1100 - 1840 B 76.67
Rocks 274.37 ns 903.24 ns 49.510 ns 272.05 ns 15.61 6.74 0.0100 - 296 B 12.33

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 20.61 ns 145.47 ns 7.973 ns 23.00 ns 1.14 0.62 - - 24 B 1.00
FakeItEasy 3,768.86 ns 52,319.64 ns 2,867.816 ns 2,212.00 ns 208.21 170.41 0.2100 0.0100 3562 B 148.42
JustMockLite 25,349.78 ns 161,795.32 ns 8,868.547 ns 20,270.98 ns 1,400.47 735.22 1.2000 0.1300 20228 B 842.83
Moq 3,124.05 ns 44,869.64 ns 2,459.456 ns 1,875.75 ns 172.59 144.92 0.1300 - 2208 B 92.00
NSubstitute 5,516.25 ns 76,864.06 ns 4,213.179 ns 3,749.82 ns 304.75 250.11 0.3400 - 5696 B 237.33
PCLMock 4,456.32 ns 7,878.98 ns 431.874 ns 4,548.63 ns 246.19 103.88 0.1000 - 1832 B 76.33
Rocks 203.02 ns 722.59 ns 39.607 ns 195.15 ns 11.22 5.05 0.0100 - 288 B 12.00

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 20.46 ns 140.27 ns 7.689 ns 22.79 ns 1.13 0.60 - - 24 B 1.00
FakeItEasy 3,891.52 ns 50,889.04 ns 2,789.400 ns 2,436.65 ns 214.66 165.97 0.2100 0.0100 3700 B 154.17
JustMockLite 25,235.37 ns 158,960.11 ns 8,713.140 ns 20,236.10 ns 1,392.02 710.14 1.2300 0.1300 20700 B 862.50
Moq 3,186.56 ns 42,964.85 ns 2,355.048 ns 1,918.29 ns 175.77 139.02 0.1300 - 2240 B 93.33
NSubstitute 4,669.42 ns 67,416.89 ns 3,695.348 ns 2,584.60 ns 257.57 214.59 0.3400 - 5728 B 238.67
PCLMock 144,182.53 ns 76,048.70 ns 4,168.486 ns 142,728.99 ns 7,953.29 3,171.16 0.6200 0.6100 10433 B 434.71
Rocks 393.59 ns 1,195.32 ns 65.520 ns 394.42 ns 21.71 9.26 0.0200 - 352 B 14.67

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 24.89 ns 145.79 ns 7.991 ns 28.25 ns 1.09 0.49 - - 24 B 1.00
FakeItEasy 5,492.33 ns 70,803.17 ns 3,880.961 ns 3,674.48 ns 240.60 174.42 0.2900 0.0100 4977 B 207.38
JustMockLite 151,157.06 ns 138,721.73 ns 7,603.806 ns 147,376.00 ns 6,621.64 2,249.81 2.0400 2.0300 34166 B 1,423.58
Moq 6,100.52 ns 78,576.47 ns 4,307.041 ns 4,349.21 ns 267.24 193.61 0.2300 - 3864 B 161.00
NSubstitute 5,387.40 ns 69,316.73 ns 3,799.484 ns 3,222.74 ns 236.00 170.83 0.4000 0.0100 6720 B 280.00
PCLMock 4,697.58 ns 16,504.49 ns 904.667 ns 5,183.29 ns 205.78 78.08 0.1200 - 2020 B 84.17
Rocks 271.79 ns 994.72 ns 54.524 ns 261.19 ns 11.91 4.56 0.0200 - 376 B 15.67

Verify

Verifies that the method was called

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 23.52 ns 134.00 ns 7.345 ns 25.84 ns 1.08 0.46 - - 24 B 1.00
FakeItEasy 6,152.69 ns 75,127.51 ns 4,117.993 ns 4,302.60 ns 283.15 193.65 0.3100 0.0100 5282 B 220.08
JustMockLite 54,350.14 ns 198,241.28 ns 10,866.274 ns 48,328.92 ns 2,501.22 916.16 2.3700 0.5900 39701 B 1,654.21
Moq 5,730.38 ns 79,291.73 ns 4,346.247 ns 3,725.30 ns 263.71 199.42 0.2200 - 3792 B 158.00
NSubstitute 5,849.46 ns 70,546.37 ns 3,866.884 ns 3,636.01 ns 269.19 182.34 0.4300 - 7208 B 300.33
PCLMock 4,835.97 ns 51,323.25 ns 2,813.201 ns 5,743.62 ns 222.55 136.86 0.1500 - 2560 B 106.67
Rocks 723.61 ns 1,187.09 ns 65.068 ns 700.01 ns 33.30 10.95 0.0300 - 600 B 25.00