Skip to content

Latest commit

 

History

History
111 lines (87 loc) · 10.3 KB

Results.md

File metadata and controls

111 lines (87 loc) · 10.3 KB

BenchmarkMockNet Results

Official Run: 12/04/2024

Framework Version
FakeItEasy 8.3.0
JustMock 2024.4.1113.345
Moq 4.20.72
NSubstitute 5.3.0
PCLMock 5.1.3
Rocks 9.0.0

Construction

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

Method Mean Error StdDev Median Ratio RatioSD Gen0 Allocated Alloc Ratio
Stub 21.92 ns 141.09 ns 7.734 ns 23.70 ns 1.11 0.53 - 24 B 1.00
FakeItEasy 3,980.41 ns 46,194.31 ns 2,532.066 ns 3,304.76 ns 201.05 137.51 0.0300 2938 B 122.42
JustMockLite 28,136.37 ns 66,462.03 ns 3,643.008 ns 26,047.76 ns 1,421.17 538.17 0.2000 16928 B 705.33
Moq 4,539.87 ns 54,657.79 ns 2,995.978 ns 3,959.12 ns 229.31 161.10 0.0200 2088 B 87.00
NSubstitute 4,610.34 ns 58,992.60 ns 3,233.584 ns 3,338.53 ns 232.87 171.24 0.0600 5064 B 211.00
PCLMock 81.27 ns 727.25 ns 39.863 ns 80.54 ns 4.10 2.36 - 144 B 6.00
Rocks 114.28 ns 649.43 ns 35.597 ns 116.96 ns 5.77 2.65 - 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 Gen2 Allocated Alloc Ratio
Stub 20.00 ns 140.37 ns 7.694 ns 22.06 ns 1.13 0.61 - - - 24 B 1.00
FakeItEasy 6,557.53 ns 80,952.12 ns 4,437.259 ns 4,157.54 ns 372.11 277.92 0.0500 0.0100 0.0100 5055 B 210.62
JustMockLite 187,100.74 ns 153,098.21 ns 8,391.830 ns 182,385.53 ns 10,617.18 4,325.82 0.4100 0.4000 - 34713 B 1,446.38
Moq 7,216.51 ns 98,008.56 ns 5,372.180 ns 4,807.78 ns 409.51 327.76 0.0400 - - 3952 B 164.67
NSubstitute 7,425.12 ns 106,521.54 ns 5,838.805 ns 4,063.17 ns 421.34 351.45 0.0900 - - 7536 B 314.00
PCLMock 4,153.44 ns 22,762.50 ns 1,247.689 ns 4,494.09 ns 235.69 115.91 0.0200 - - 1800 B 75.00
Rocks 428.98 ns 1,934.62 ns 106.043 ns 387.88 ns 24.34 11.33 - - - 376 B 15.67

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 20.40 ns 145.48 ns 7.974 ns 22.37 ns 1.14 0.62 - - 24 B 1.00
FakeItEasy 4,966.61 ns 61,618.52 ns 3,377.519 ns 3,695.11 ns 277.18 208.70 0.0400 - 3809 B 158.71
JustMockLite 35,981.92 ns 126,940.79 ns 6,958.053 ns 31,982.32 ns 2,008.13 899.01 0.2400 0.1100 20641 B 860.04
Moq 4,953.10 ns 67,781.09 ns 3,715.310 ns 3,397.27 ns 276.43 223.42 0.0200 - 2456 B 102.33
NSubstitute 5,676.17 ns 80,205.68 ns 4,396.344 ns 3,175.17 ns 316.78 262.26 0.0600 - 5760 B 240.00
PCLMock 3,964.90 ns 23,672.27 ns 1,297.557 ns 4,529.38 ns 221.28 112.94 0.0200 - 1800 B 75.00
Rocks 338.55 ns 1,928.35 ns 105.699 ns 307.14 ns 18.89 9.49 - - 376 B 15.67

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.33 ns 143.43 ns 7.862 ns 22.16 ns 1.13 0.61 - - 24 B 1.00
FakeItEasy 5,279.97 ns 66,195.26 ns 3,628.386 ns 4,074.53 ns 294.48 221.78 0.0400 - 3785 B 157.71
JustMockLite 35,621.65 ns 129,000.99 ns 7,070.980 ns 31,545.01 ns 1,986.74 879.19 0.2400 0.1100 20529 B 855.38
Moq 4,416.85 ns 59,264.63 ns 3,248.494 ns 3,016.04 ns 246.34 194.93 0.0200 - 2432 B 101.33
NSubstitute 5,235.58 ns 70,096.90 ns 3,842.248 ns 3,138.10 ns 292.01 230.69 0.0600 - 5760 B 240.00
PCLMock 3,746.25 ns 24,150.26 ns 1,323.757 ns 3,999.61 ns 208.94 108.40 0.0200 - 1784 B 74.33
Rocks 294.88 ns 1,695.87 ns 92.956 ns 261.91 ns 16.45 8.18 - - 328 B 13.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 19.85 ns 134.17 ns 7.355 ns 22.55 ns 1.13 0.59 - - 24 B 1.00
FakeItEasy 5,037.68 ns 63,019.22 ns 3,454.296 ns 3,660.07 ns 286.12 214.21 0.0400 - 3921 B 163.38
JustMockLite 35,918.35 ns 116,894.03 ns 6,407.356 ns 32,404.15 ns 2,040.05 878.56 0.2500 0.1100 21001 B 875.04
Moq 4,395.96 ns 59,496.97 ns 3,261.230 ns 2,943.79 ns 249.68 198.03 0.0200 - 2464 B 102.67
NSubstitute 5,292.97 ns 70,211.33 ns 3,848.520 ns 3,145.33 ns 300.62 234.89 0.0600 - 5792 B 241.33
PCLMock 126,630.98 ns 82,679.22 ns 4,531.927 ns 124,237.18 ns 7,192.25 2,870.92 0.1200 0.1100 10478 B 436.58
Rocks 535.07 ns 2,286.96 ns 125.356 ns 484.05 ns 30.39 13.77 - - 392 B 16.33

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 23.80 ns 137.75 ns 7.551 ns 26.43 ns 1.09 0.47 - - 24 B 1.00
FakeItEasy 6,435.55 ns 78,626.44 ns 4,309.781 ns 4,097.05 ns 293.70 202.50 0.0600 0.0100 5247 B 218.62
JustMockLite 165,805.10 ns 124,869.53 ns 6,844.520 ns 161,891.83 ns 7,566.92 2,491.64 0.4100 0.4000 34689 B 1,445.38
Moq 7,293.69 ns 99,574.81 ns 5,458.031 ns 4,672.58 ns 332.87 250.64 0.0400 - 4112 B 171.33
NSubstitute 6,361.13 ns 84,003.99 ns 4,604.542 ns 3,733.59 ns 290.31 212.81 0.0800 - 6784 B 282.67
PCLMock 3,973.67 ns 30,900.74 ns 1,693.774 ns 4,320.88 ns 181.35 91.80 0.0200 - 1992 B 83.00
Rocks 398.71 ns 2,197.96 ns 120.478 ns 350.16 ns 18.20 7.76 - - 416 B 17.33

Verify

Verifies that the method was called

Method Mean Error StdDev Median Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Stub 28.69 ns 294.01 ns 16.12 ns 25.00 ns 1.24 0.88 - - 24 B 1.00
FakeItEasy 6,885.35 ns 90,069.79 ns 4,937.03 ns 4,270.25 ns 297.10 244.85 0.0600 0.0100 5567 B 231.96
JustMockLite 79,479.13 ns 158,326.48 ns 8,678.41 ns 74,514.44 ns 3,429.49 1,642.31 0.4700 0.4600 39810 B 1,658.75
Moq 7,394.65 ns 102,095.03 ns 5,596.17 ns 4,507.46 ns 319.08 272.93 0.0400 - 4016 B 167.33
NSubstitute 6,855.15 ns 79,735.93 ns 4,370.60 ns 4,365.06 ns 295.80 225.81 0.0800 - 7272 B 303.00
PCLMock 4,701.80 ns 46,629.21 ns 2,555.90 ns 5,118.33 ns 202.88 141.05 0.0300 - 2560 B 106.67
Rocks 863.52 ns 3,578.30 ns 196.14 ns 769.67 ns 37.26 19.18 - - 640 B 26.67