Skip to content

Latest commit

 

History

History
111 lines (87 loc) · 9.19 KB

Results.md

File metadata and controls

111 lines (87 loc) · 9.19 KB

BenchmarkMockNet Results

Official Run: 11/07/2023

Framework Version
FakeItEasy 8.0.0
JustMock 2023.3.1011.155
Moq 4.20.69
NSubstitute 5.1.0
PCLMock 5.1.3
Rocks 7.1.4

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 31.34 ns 211.41 ns 11.59 ns 1.00 0.00 - - 24 B 1.00
FakeItEasy 4,979.65 ns 30,856.32 ns 1,691.34 ns 167.74 52.16 0.1500 0.0100 2962 B 123.42
JustMockLite 48,256.19 ns 35,224.70 ns 1,930.78 ns 1,719.42 739.33 0.9100 0.0100 17033 B 709.71
Moq 4,585.05 ns 19,632.53 ns 1,076.13 ns 157.27 51.49 0.1100 - 2088 B 87.00
NSubstitute 5,473.06 ns 29,137.72 ns 1,597.14 ns 185.43 56.33 0.2700 - 5176 B 215.67
PCLMock 155.87 ns 1,080.57 ns 59.23 ns 5.03 0.70 - - 144 B 6.00
Rocks 146.48 ns 1,090.11 ns 59.75 ns 4.69 0.62 - - 144 B 6.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 Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 28.90 ns 212.68 ns 11.66 ns 1.00 0.00 - - 24 B 1.00
FakeItEasy 8,969.13 ns 38,381.23 ns 2,103.80 ns 343.22 134.31 0.2600 0.0100 4982 B 207.58
JustMockLite 280,723.96 ns 105,038.74 ns 5,757.53 ns 11,205.96 5,574.96 1.8500 1.8400 34629 B 1,442.88
Moq 7,620.79 ns 26,993.24 ns 1,479.59 ns 294.42 121.71 0.2100 - 3952 B 164.67
NSubstitute 9,560.75 ns 32,758.64 ns 1,795.61 ns 369.85 153.98 0.4000 0.0100 7648 B 318.67
PCLMock 3,186.99 ns 15,562.04 ns 853.01 ns 120.68 43.98 0.1000 - 1912 B 79.67
Rocks 822.79 ns 2,695.01 ns 147.72 ns 31.05 9.61 0.0300 - 680 B 28.33

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 28.71 ns 204.15 ns 11.19 ns 1.00 0.00 - - 24 B 1.00
FakeItEasy 5,890.26 ns 29,446.18 ns 1,614.04 ns 223.10 80.85 0.2000 0.0100 3833 B 159.71
JustMockLite 60,504.16 ns 41,721.72 ns 2,286.91 ns 2,398.37 1,130.18 1.1100 0.1200 20858 B 869.08
Moq 5,204.82 ns 20,856.75 ns 1,143.23 ns 200.98 83.37 0.1300 - 2456 B 102.33
NSubstitute 7,862.23 ns 31,442.13 ns 1,723.45 ns 299.91 110.04 0.3100 - 5872 B 244.67
PCLMock 3,256.73 ns 13,948.61 ns 764.57 ns 124.13 45.95 0.1000 - 1912 B 79.67
Rocks 789.88 ns 1,424.53 ns 78.08 ns 30.92 13.42 0.0300 - 680 B 28.33

EmptyMethod

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

Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 28.84 ns 206.64 ns 11.33 ns 1.00 0.00 - - 24 B 1.00
FakeItEasy 6,006.92 ns 27,867.68 ns 1,527.52 ns 226.54 78.82 0.2000 0.0100 3785 B 157.71
JustMockLite 60,569.59 ns 41,286.68 ns 2,263.06 ns 2,397.36 1,142.45 1.1100 0.1300 20748 B 864.50
Moq 4,646.49 ns 22,813.25 ns 1,250.47 ns 175.53 63.52 0.1300 - 2432 B 101.33
NSubstitute 6,980.76 ns 31,131.66 ns 1,706.43 ns 266.23 103.37 0.3100 - 5872 B 244.67
PCLMock 3,090.80 ns 15,101.93 ns 827.79 ns 116.08 39.15 0.1000 - 1872 B 78.00
Rocks 713.38 ns 1,572.38 ns 86.19 ns 27.55 10.94 0.0300 - 672 B 28.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 Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 28.64 ns 202.43 ns 11.10 ns 1.00 0.00 - - 24 B 1.00
FakeItEasy 6,006.30 ns 29,564.27 ns 1,620.52 ns 228.04 82.64 0.2000 0.0100 3922 B 163.42
JustMockLite 60,026.49 ns 42,608.40 ns 2,335.51 ns 2,380.53 1,110.35 1.1300 0.1200 21220 B 884.17
Moq 4,844.69 ns 22,506.18 ns 1,233.64 ns 184.21 66.53 0.1300 - 2464 B 102.67
NSubstitute 7,445.89 ns 32,069.41 ns 1,757.83 ns 283.07 99.70 0.3100 - 5904 B 246.00
PCLMock 234,568.49 ns 114,493.45 ns 6,275.77 ns 9,373.17 4,580.23 0.5600 0.5500 10584 B 441.00
Rocks 936.82 ns 5,065.72 ns 277.67 ns 33.92 4.93 0.0400 - 792 B 33.00

Callback

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

Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 36.04 ns 211.35 ns 11.58 ns 1.00 0.00 - - 24 B 1.00
FakeItEasy 9,730.53 ns 41,163.62 ns 2,256.32 ns 284.24 81.51 0.2700 0.0100 5167 B 215.29
JustMockLite 314,033.86 ns 71,902.79 ns 3,941.23 ns 9,480.39 3,595.73 1.8300 1.8200 34287 B 1,428.62
Moq 7,799.30 ns 25,730.45 ns 1,410.37 ns 229.49 68.42 0.2200 - 4112 B 171.33
NSubstitute 9,171.73 ns 31,745.34 ns 1,740.07 ns 269.03 76.95 0.3600 - 6896 B 287.33
PCLMock 3,867.43 ns 18,210.21 ns 998.16 ns 112.21 30.07 0.1100 - 2080 B 86.67
Rocks 777.72 ns 1,593.74 ns 87.36 ns 22.97 6.67 0.0400 - 760 B 31.67

Verify

Verifies that the method was called

Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 33.64 ns 201.12 ns 11.02 ns 1.00 0.00 - - 24 B 1.00
FakeItEasy 9,186.06 ns 40,565.27 ns 2,223.52 ns 287.89 84.23 0.2900 0.0100 5489 B 228.71
JustMockLite 134,882.54 ns 39,368.39 ns 2,157.91 ns 4,375.22 1,685.94 2.1500 0.5300 40260 B 1,677.50
Moq 8,506.66 ns 25,250.99 ns 1,384.09 ns 269.44 82.73 0.2100 - 4072 B 169.67
NSubstitute 10,575.58 ns 38,199.33 ns 2,093.83 ns 333.07 97.84 0.3900 - 7464 B 311.00
PCLMock 4,121.90 ns 16,560.56 ns 907.74 ns 129.45 37.61 0.1400 - 2736 B 114.00
Rocks 1,027.11 ns 1,942.11 ns 106.45 ns 32.66 10.03 0.0400 - 800 B 33.33