Skip to content

Benchmark nullable integral LINQ Sum - #5366

Open
tedd wants to merge 1 commit into
dotnet:mainfrom
tedd:codex/nullable-linq-sum-benchmarks
Open

tedd wants to merge 1 commit into
dotnet:mainfrom
tedd:codex/nullable-linq-sum-benchmarks

Conversation

@tedd

@tedd tedd commented Nov 16, 2026

Copy link
Copy Markdown

Add nullable Enumerable.Sum() benchmarks to track batch throughput and singleton call costs.

  • Sum 32,768 int? or long? values with seeded data and about 50% nulls.
  • Sum the same one-element int?[] through array-typed and IEnumerable<int?> fields so the suite can track the effect of caller type on JIT optimization.

The timed methods call Sum() once and consume the result. Input creation is in GlobalSetup. Related runtime change and baseline comparison are in dotnet/runtime#137689.

Validation

The Release MicroBenchmarks project built for net12.0, and BenchmarkDotNet completed all four *Perf_NullableSum* cases. git diff --check passed.

Note

OpenAI Codex assisted with the benchmarks and PR description.

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