Skip to content

test: declare explicit lambda parameter types in chained Initialize calls - #1102

Merged
vbreuss merged 1 commit into
mainfrom
test/explicit-initialize-lambda-types
Nov 21, 2026
Merged

vbreuss merged 1 commit into
mainfrom
test/explicit-initialize-lambda-types

Conversation

@vbreuss

@vbreuss vbreuss commented Nov 21, 2026

Copy link
Copy Markdown
Member

Each mockable type generates its own Initialize overload, so implicitly typed lambdas get bound hundreds of times during overload resolution, which Roslyn reports as a maintainability issue.

…alls

Each mockable type generates its own Initialize<T> overload, so implicitly typed lambdas get bound hundreds of times during overload resolution, which Roslyn reports as a maintainability issue.
@vbreuss vbreuss self-assigned this Nov 21, 2026
@vbreuss
vbreuss enabled auto-merge (squash) November 21, 2026 15:28

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This appears safe to merge; no actionable issues were found.

Summary

Adds explicit lambda parameter types to three chained Initialize calls in one test, reducing compiler work without changing what the test checks.

  • The chained initialization test names each lambda’s setup type.

No actionable issues found.

Reviews (1) · Last reviewed commit: "test: declare explicit lambda parameter ..." · Reviewed by Greptile

@sonarqubecloud

Copy link
Copy Markdown

@vbreuss
vbreuss disabled auto-merge November 21, 2026 15:43
@vbreuss
vbreuss merged commit edb775b into main Nov 21, 2026
26 checks passed
@vbreuss
vbreuss deleted the test/explicit-initialize-lambda-types branch November 21, 2026 15:43
@github-actions

Copy link
Copy Markdown

🚀 Benchmark Results

Compared to main, which ran on the same runner. Times that change by more than 10% are marked.

Memory

Benchmark main PR Δ
Unconfigured (N=1000) 273,296 B 273,297 B 🔴 +1 B (±0%)
Indexer (N=1000) 105,720 B 105,721 B 🔴 +1 B (±0%)
Async (N=1000) 224,800 B 224,801 B 🔴 +1 B (±0%)

Time

Benchmark main PR Δ
Property (N=10) 600.1 ns 1.11 μs 🔴 +86%
CompleteWorkflowBenchmarks
Complete Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 1.663 μs 0.0141 μs 0.0110 μs 1.00 5.14 KB 1.00
Imposter 1.997 μs 0.0643 μs 0.0602 μs 1.20 7.21 KB 1.40
TUnitMocks 4.328 μs 0.0397 μs 0.0352 μs 2.60 16.95 KB 3.30
Moq 1,035.942 μs 6.9457 μs 6.4970 μs 622.88 90.49 KB 17.60
NSubstitute 272.094 μs 1.1653 μs 1.0900 μs 163.60 53.11 KB 10.33
FakeItEasy 304.555 μs 1.6572 μs 1.4691 μs 183.12 63.98 KB 12.45
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V74 3.69GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

MockCreationBenchmarks
CreateMock Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 14.86 ns 0.359 ns 0.336 ns 1.00 136 B 1.00
Imposter 87.05 ns 3.047 ns 2.701 ns 5.86 504 B 3.71
TUnitMocks 25.58 ns 0.201 ns 0.188 ns 1.72 216 B 1.59
Moq 1,274.24 ns 5.169 ns 4.316 ns 85.81 2088 B 15.35
NSubstitute 1,807.96 ns 15.852 ns 14.052 ns 121.76 5032 B 37.00
FakeItEasy 1,598.82 ns 22.285 ns 19.755 ns 107.67 2755 B 20.26
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 2.67GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

CompleteUnconfiguredBenchmarks
Unconfigured N Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 1 244.5 ns 4.33 ns 4.05 ns 1.00 1.51 KB 1.00
Imposter 1 150.0 ns 1.67 ns 1.48 ns 0.61 1.06 KB 0.70
TUnitMocks 1 322.6 ns 1.63 ns 1.45 ns 1.32 1.81 KB 1.20
Moq 1 29,378.8 ns 336.53 ns 314.79 ns 120.18 9.8 KB 6.50
NSubstitute 1 3,537.6 ns 24.60 ns 20.54 ns 14.47 10.01 KB 6.64
FakeItEasy 1 3,575.8 ns 132.73 ns 124.15 ns 14.63 11.58 KB 7.68
Mockolate 10 963.5 ns 4.14 ns 3.67 ns 1.00 3.92 KB 1.00
Imposter 10 599.6 ns 7.60 ns 6.74 ns 0.62 2.89 KB 0.74
TUnitMocks 10 2,066.7 ns 12.21 ns 10.82 ns 2.15 8.47 KB 2.16
Moq 10 36,368.8 ns 249.93 ns 233.79 ns 37.75 24.53 KB 6.25
NSubstitute 10 11,124.2 ns 71.38 ns 63.28 ns 11.55 22.93 KB 5.85
FakeItEasy 10 14,002.2 ns 296.21 ns 262.58 ns 14.53 53.92 KB 13.75
Mockolate 1000 81,301.7 ns 1,041.53 ns 974.25 ns 1.00 266.89 KB 1.00
Imposter 1000 52,347.8 ns 1,164.39 ns 1,032.20 ns 0.64 203.99 KB 0.76
TUnitMocks 1000 202,165.8 ns 1,606.71 ns 1,341.67 ns 2.49 691.2 KB 2.59
Moq 1000 747,195.1 ns 7,735.93 ns 7,236.19 ns 9.19 1653 KB 6.19
NSubstitute 1000 879,079.9 ns 11,445.17 ns 10,705.82 ns 10.81 1434.48 KB 5.37
FakeItEasy 1000 1,570,837.5 ns 32,214.64 ns 28,557.44 ns 19.32 4690.79 KB 17.58
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V45 4.53GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

CompleteMethodBenchmarks
Method N Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 1 98.72 ns 0.750 ns 0.702 ns 1.00 592 B 1.00
Imposter 1 144.45 ns 0.619 ns 0.548 ns 1.46 808 B 1.36
TUnitMocks 1 361.07 ns 1.290 ns 1.077 ns 3.66 2136 B 3.61
Moq 1 3,276.84 ns 20.405 ns 17.039 ns 33.19 6552 B 11.07
NSubstitute 1 4,025.29 ns 28.762 ns 25.496 ns 40.78 9816 B 16.58
FakeItEasy 1 3,223.36 ns 14.019 ns 13.113 ns 32.65 7517 B 12.70
Mockolate 10 267.67 ns 0.452 ns 0.400 ns 1.00 1096 B 1.00
Imposter 10 291.50 ns 2.112 ns 1.976 ns 1.09 1168 B 1.07
TUnitMocks 10 1,028.80 ns 3.966 ns 3.097 ns 3.84 3888 B 3.55
Moq 10 4,646.72 ns 63.593 ns 59.485 ns 17.36 10536 B 9.61
NSubstitute 10 6,058.38 ns 48.033 ns 44.930 ns 22.63 12840 B 11.72
FakeItEasy 10 5,710.03 ns 42.220 ns 39.493 ns 21.33 15754 B 14.37
Mockolate 1000 19,729.37 ns 70.960 ns 62.905 ns 1.00 56536 B 1.00
Imposter 1000 17,646.90 ns 44.421 ns 39.378 ns 0.89 40768 B 0.72
TUnitMocks 1000 75,038.09 ns 353.825 ns 313.657 ns 3.80 203633 B 3.60
Moq 1000 143,181.31 ns 434.016 ns 384.744 ns 7.26 423564 B 7.49
NSubstitute 1000 199,621.96 ns 1,104.349 ns 978.977 ns 10.12 378535 B 6.70
FakeItEasy 1000 281,435.66 ns 2,839.893 ns 2,656.438 ns 14.26 943722 B 16.69
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V74 3.67GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

CompletePropertyBenchmarks
Property N Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 1 264.4 ns 6.14 ns 5.74 ns 1.00 920 B 1.00
Imposter 1 161.4 ns 1.93 ns 1.61 ns 0.61 672 B 0.73
TUnitMocks 1 422.6 ns 4.19 ns 3.71 ns 1.60 1672 B 1.82
Moq 1 10,978.9 ns 82.68 ns 73.30 ns 41.54 10458 B 11.37
NSubstitute 1 7,756.0 ns 45.84 ns 38.28 ns 29.34 11664 B 12.68
FakeItEasy 1 7,937.6 ns 92.05 ns 86.11 ns 30.03 11196 B 12.17
Mockolate 10 1,114.9 ns 5.19 ns 4.33 ns 1.00 1784 B 1.00
Imposter 10 314.3 ns 4.18 ns 3.70 ns 0.28 960 B 0.54
TUnitMocks 10 1,521.2 ns 13.66 ns 12.78 ns 1.36 4024 B 2.26
Moq 10 17,284.5 ns 129.88 ns 121.49 ns 15.50 17385 B 9.74
NSubstitute 10 18,057.3 ns 141.89 ns 132.72 ns 16.20 21529 B 12.07
FakeItEasy 10 18,996.3 ns 124.25 ns 116.23 ns 17.04 30785 B 17.26
Mockolate 1000 38,404.4 ns 211.92 ns 176.97 ns 1.00 96824 B 1.00
Imposter 1000 16,246.4 ns 196.95 ns 174.59 ns 0.42 32641 B 0.34
TUnitMocks 1000 113,339.2 ns 606.50 ns 567.32 ns 2.95 242489 B 2.50
Moq 1000 650,130.1 ns 7,669.12 ns 6,798.47 ns 16.93 724511 B 7.48
NSubstitute 1000 1,136,527.3 ns 6,598.14 ns 5,509.75 ns 29.59 1139704 B 11.77
FakeItEasy 1000 1,247,031.9 ns 18,700.62 ns 16,577.61 ns 32.47 2194291 B 22.66
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 3.24GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

CompleteIndexerBenchmarks
Indexer N Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 1 504.0 ns 14.67 ns 13.01 ns 1.00 1.78 KB 1.00
Imposter 1 340.4 ns 13.58 ns 12.70 ns 0.68 1.19 KB 0.67
TUnitMocks 1 849.4 ns 11.17 ns 10.45 ns 1.69 2.79 KB 1.57
Moq 1 539,292.3 ns 2,433.94 ns 2,276.71 ns 1,070.69 37.59 KB 21.10
NSubstitute 1 216,716.0 ns 1,103.40 ns 1,032.12 ns 430.26 27.44 KB 15.41
FakeItEasy 1 247,769.2 ns 2,024.11 ns 1,893.35 ns 491.91 29.63 KB 16.63
Mockolate 10 1,391.0 ns 17.00 ns 15.07 ns 1.00 2.7 KB 1.00
Imposter 10 819.1 ns 6.30 ns 5.89 ns 0.59 2.24 KB 0.83
TUnitMocks 10 2,605.8 ns 17.74 ns 15.72 ns 1.87 5.44 KB 2.02
Moq 10 552,765.9 ns 2,776.07 ns 2,596.74 ns 397.43 46.94 KB 17.41
NSubstitute 10 235,663.4 ns 855.93 ns 758.76 ns 169.44 40.25 KB 14.93
FakeItEasy 10 275,525.4 ns 2,211.58 ns 2,068.71 ns 198.10 48.84 KB 18.12
Mockolate 1000 98,109.5 ns 523.15 ns 489.36 ns 1.00 103.24 KB 1.00
Imposter 1000 52,454.5 ns 273.60 ns 255.92 ns 0.53 118.26 KB 1.15
TUnitMocks 1000 187,700.6 ns 1,635.49 ns 1,529.84 ns 1.91 293.74 KB 2.85
Moq 1000 1,374,731.5 ns 6,274.04 ns 5,868.74 ns 14.01 1023.76 KB 9.92
NSubstitute 1000 1,865,514.7 ns 11,942.75 ns 11,171.26 ns 19.02 1480.33 KB 14.34
FakeItEasy 1000 1,769,029.0 ns 17,530.40 ns 14,638.68 ns 18.03 2169.41 KB 21.01
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 3.23GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

CompleteEventBenchmarks
Event Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 115.7 ns 0.90 ns 0.79 ns 1.00 712 B 1.00
Imposter 140.8 ns 1.74 ns 1.55 ns 1.22 512 B 0.72
TUnitMocks 122.6 ns 2.27 ns 2.12 ns 1.06 1392 B 1.96
Moq 10,535.0 ns 30.60 ns 25.56 ns 91.07 12984 B 18.24
NSubstitute 3,909.0 ns 20.42 ns 19.10 ns 33.79 9192 B 12.91
FakeItEasy 195,949.6 ns 1,008.46 ns 943.31 ns 1,693.92 15618 B 21.94
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V74 3.69GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

CallbackBenchmarks
Callback Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 158.8 ns 3.02 ns 2.83 ns 1.00 800 B 1.00
Imposter 166.7 ns 2.52 ns 2.24 ns 1.05 616 B 0.77
TUnitMocks 410.2 ns 5.50 ns 5.15 ns 2.58 2056 B 2.57
Moq 36,800.1 ns 135.42 ns 126.68 ns 231.84 9046 B 11.31
NSubstitute 3,093.9 ns 53.60 ns 50.14 ns 19.49 7864 B 9.83
FakeItEasy 2,818.6 ns 84.33 ns 78.88 ns 17.76 6924 B 8.65
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
Intel Xeon 6975P-C 3.70GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

AsyncBenchmarks
Async N Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 1 172.3 ns 2.60 ns 2.43 ns 1.00 1 KB 1.00
Imposter 1 265.2 ns 7.98 ns 7.07 ns 1.54 1.58 KB 1.58
TUnitMocks 1 625.5 ns 18.63 ns 16.51 ns 3.63 4.36 KB 4.36
Moq 1 92,297.3 ns 1,399.25 ns 1,240.40 ns 535.81 22.77 KB 22.77
NSubstitute 1 7,432.4 ns 207.05 ns 193.68 ns 43.15 19.28 KB 19.28
FakeItEasy 1 5,172.0 ns 80.14 ns 74.97 ns 30.02 14 KB 14.00
Mockolate 10 883.7 ns 15.00 ns 14.03 ns 1.00 2.97 KB 1.00
Imposter 10 839.1 ns 10.83 ns 9.60 ns 0.95 3.41 KB 1.15
TUnitMocks 10 2,897.9 ns 24.74 ns 20.66 ns 3.28 10.29 KB 3.47
Moq 10 106,720.2 ns 777.54 ns 689.27 ns 120.79 40.19 KB 13.54
NSubstitute 10 13,899.2 ns 153.98 ns 144.03 ns 15.73 30.6 KB 10.31
FakeItEasy 10 20,355.3 ns 86.05 ns 71.86 ns 23.04 59.08 KB 19.90
Mockolate 1000 77,164.2 ns 509.01 ns 476.13 ns 1.00 219.53 KB 1.00
Imposter 1000 66,701.5 ns 881.17 ns 781.14 ns 0.86 204.5 KB 0.93
TUnitMocks 1000 260,400.8 ns 2,932.39 ns 2,448.68 ns 3.37 687.49 KB 3.13
Moq 1000 1,965,197.5 ns 20,773.89 ns 19,431.91 ns 25.47 1891.03 KB 8.61
NSubstitute 1000 652,066.8 ns 2,830.94 ns 2,210.21 ns 8.45 1202.62 KB 5.48
FakeItEasy 1000 2,063,350.0 ns 20,557.34 ns 17,166.31 ns 26.74 4933.41 KB 22.47
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V45 4.54GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

SequenceBenchmarks
Sequence Mean Error StdDev Ratio Allocated Alloc Ratio
Mockolate 2.590 μs 0.0342 μs 0.0320 μs 1.00 2.23 KB 1.00
Imposter 2.330 μs 0.0095 μs 0.0079 μs 0.90 2.23 KB 1.00
TUnitMocks 2.953 μs 0.0083 μs 0.0078 μs 1.14 3.27 KB 1.46
Moq 9.673 μs 0.0432 μs 0.0383 μs 3.74 10.79 KB 4.83
NSubstitute 8.451 μs 0.0491 μs 0.0435 μs 3.26 14.29 KB 6.40
FakeItEasy 8.819 μs 0.0249 μs 0.0233 μs 3.41 14.28 KB 6.39
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V74 3.67GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

github-actions Bot added a commit that referenced this pull request Nov 21, 2026
… types in chained Initialize calls (#1102) by Valentin Breuß
github-actions Bot added a commit that referenced this pull request Nov 21, 2026
… types in chained Initialize calls (#1102) by Valentin Breuß
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant