feat(#132): Upgrade BenchmarkDotNet from 0.13.12 to 0.15.8#133
Merged
LeeCampbell merged 5 commits intoHdrHistogram:mainfrom Mar 2, 2026
Conversation
555d823 to
37bf987
Compare
LeeCampbell
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #132: Upgrade BenchmarkDotNet from 0.13.12 to 0.15.8
Summary
The benchmarking project (
HdrHistogram.Benchmarking) currently references BenchmarkDotNet 0.13.12.The target version is 0.15.8.
Both
BenchmarkDotNetandBenchmarkDotNet.Diagnostics.Windowsmust be updated together, as they are companion packages that must always share the same version.The upgrade spans two minor versions (0.13 → 0.14 → 0.15) and brings .NET 10 support, new Roslyn analysers for compile-time correctness checking, a WakeLock feature to prevent system sleep during benchmarks, improved engine internals, and numerous bug fixes.
Affected Files
The following files are confirmed by exploration:
Primary change
HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj— contains the two<PackageReference>elements to update from0.13.12to0.15.8.Source files that import BenchmarkDotNet APIs (may need fixes if breaking changes exist)
HdrHistogram.Benchmarking/Program.cs— runner entry point; usesBenchmarkSwitcher/BenchmarkRunnerconfiguration.HdrHistogram.Benchmarking/LeadingZeroCount/LeadingZeroCountBenchmarkBase.cs— base class with[Benchmark]attributes and benchmark methods.HdrHistogram.Benchmarking/Recording/Recording32BitBenchmark.cs— benchmark class with[Benchmark]attributes.Documentation that records the version number
spec/tech-standards/build-system.md— listsBenchmarkDotNetversion0.13.12in the Dependencies section; must be updated to0.15.8after the code change is verified.What Needs to Change
HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj, change both package versions from0.13.12to0.15.8.<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>and<AnalysisLevel>latest-recommended</AnalysisLevel>settings inherited fromDirectory.Build.props.spec/tech-standards/build-system.mdto record the new version.Acceptance Criteria
BenchmarkDotNetversion inHdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csprojis0.15.8.BenchmarkDotNet.Diagnostics.Windowsversion in the same file is0.15.8.dotnet build HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Releaseexits with code 0 and no errors or warnings treated as errors.dotnet build HdrHistogram.sln -c Releaseexits with code 0 (full solution build is clean).spec/tech-standards/build-system.mdno longer references0.13.12; it references0.15.8instead.Test Strategy
BenchmarkDotNet is a developer tool, not shipped library code, so there are no unit tests to add or modify.
Verification is build-based:
dotnet restore HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csprojto pull the new packages.dotnet build HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Releaseand confirm zero errors and zero warnings-as-errors.dotnet build HdrHistogram.sln -c Releaseto confirm the full solution still compiles cleanly.dotnet run --project HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Release -- --list flat(dry-run discovery) to confirm BenchmarkDotNet can enumerate all benchmarks without crashing at start-up.No new test files are required.
Risks and Open Questions
Breaking changes (two-minor-version jump)
BenchmarkDotNet follows semantic versioning loosely.
The 0.14.x series and 0.15.x series may contain breaking changes to public configuration APIs used in
Program.cs.The
BenchmarkRunner.Run/BenchmarkSwitcher.FromAssemblysurface is historically stable, but job/column/exporter configuration APIs have changed in the past.Risk: low to medium — inspect compiler output after the version bump to surface any issues.
New Roslyn analysers
BenchmarkDotNet 0.15.x ships new compile-time analysers.
Under
<AnalysisLevel>latest-recommended</AnalysisLevel>and<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>(set inDirectory.Build.props), new analyser warnings may be promoted to errors.If this occurs, the benchmark source files must be corrected to satisfy the analysers.
Risk: low — the existing benchmark code is simple and unlikely to trigger new rules.
BenchmarkDotNet.Diagnostics.Windowson non-WindowsBenchmarkDotNet.Diagnostics.Windowsis a conditional dependency.On Linux (WSL2, CI), the package must still restore and build without error even though its ETW-based diagnostics cannot run.
BenchmarkDotNet has historically handled this gracefully; no change is expected.
Risk: very low.
spec/tech-standards/build-system.mddriftThe spec file hard-codes the package version.
It must be updated as part of this issue to prevent stale documentation.
This is a documentation-only risk; no code impact.
Task breakdown
Task List: Upgrade BenchmarkDotNet from 0.13.12 to 0.15.8 (Issue #132)
Context
The
HdrHistogram.Benchmarkingproject must have bothBenchmarkDotNetandBenchmarkDotNet.Diagnostics.Windowsupgraded from0.13.12to0.15.8.The upgrade spans two minor versions and may introduce breaking API changes or new Roslyn analyser diagnostics.
Verification is build-based — no unit test changes are required.
Tasks
1. Update package references in the project file
Task 1 — In
HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csprojline 9, changeVersion="0.13.12"toVersion="0.15.8"for theBenchmarkDotNet<PackageReference>.HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />.Task 2 — In
HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csprojlines 10–12, change<Version>0.13.12</Version>to<Version>0.15.8</Version>for theBenchmarkDotNet.Diagnostics.Windows<PackageReference>.HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csprojBenchmarkDotNetversion exactly.<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows"><Version>0.15.8</Version></PackageReference>.2. Restore packages
dotnet restore HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csprojand confirm it exits with code 0.HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj0.15.8NuGet packages from the feed before attempting compilation.BenchmarkDotNet 0.15.8appears in restored packages.3. Attempt first build and capture diagnostics
dotnet build HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Releaseand capture the full compiler output.HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj(and referenced source files)4. Investigate and fix breaking changes in
Program.csProgram.csconfigures jobs targeting several runtimes that may have been removed or renamed in BenchmarkDotNet 0.14/0.15.Task 5 — Check whether
ClrRuntime.Net481still exists inBenchmarkDotNet.Environmentsin 0.15.8; if it has been removed or renamed, updateProgram.csaccordingly.HdrHistogram.Benchmarking/Program.csline 19–20ClrRuntime.Net481andJit.LegacyJitwere historically only supported on Windows; BenchmarkDotNet 0.15.x may have removed or deprecated support for these.CS0117/CS0103compiler error referencingClrRuntimeorJit.LegacyJit.Task 6 — Check whether
CoreRuntime.Core21,CoreRuntime.Core31,CoreRuntime.Core50still exist in 0.15.8; if any have been removed as EOL runtimes, remove or replace those.AddJob(...)calls inProgram.cs.HdrHistogram.Benchmarking/Program.cslines 21–23CS0117compiler error referencingCoreRuntime.Core21,CoreRuntime.Core31, orCoreRuntime.Core50.Task 7 — Check whether
StatisticColumn.P0,StatisticColumn.Q1,StatisticColumn.P67,StatisticColumn.Q3,StatisticColumn.P80,StatisticColumn.P90,StatisticColumn.P95,StatisticColumn.P100still exist inBenchmarkDotNet.Columnsin 0.15.8; if any have been renamed or removed, updateProgram.cs.HdrHistogram.Benchmarking/Program.csline 18CS0117compiler error referencing anyStatisticColumn.*member.Task 8 — Check whether
ManualConfig.Create,DefaultConfig.Instance,BenchmarkSwitcher, andswitcher.RunAPIs remain present and have the same signatures in 0.15.8; fix any signature mismatches if they do not.HdrHistogram.Benchmarking/Program.cslines 13, 29, 34CS1061,CS0246, or overload-resolution errors on these call sites.5. Investigate and fix breaking changes in benchmark source files
Task 9 — Check whether
[BenchmarkDotNet.Attributes.GlobalSetup]and[Benchmark]attributes remain unchanged in the BenchmarkDotNet 0.15.8Attributesnamespace; fix any namespace or attribute-name changes if present.HdrHistogram.Benchmarking/LeadingZeroCount/LeadingZeroCountBenchmarkBase.csline 49 and benchmark methodsCS0246errors referencingGlobalSetuporBenchmarkattributes.Task 10 — Confirm
[Benchmark(Baseline = true, OperationsPerInvoke = ...)]constructor parameters are still valid in 0.15.8; fix any parameter changes if present.HdrHistogram.Benchmarking/Recording/Recording32BitBenchmark.cs(all[Benchmark]attribute usages)CS0246,CS1739, orCS1503errors on[Benchmark(...)]usages.6. Fix new Roslyn analyser diagnostics
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>and<AnalysisLevel>latest-recommended</AnalysisLevel>(set inDirectory.Build.props); fix any new violations in the benchmarking source files.HdrHistogram.Benchmarking/Program.cs,HdrHistogram.Benchmarking/LeadingZeroCount/LeadingZeroCountBenchmarkBase.cs,HdrHistogram.Benchmarking/Recording/Recording32BitBenchmark.cserrorlines.7. Verify benchmarking project build succeeds
dotnet build HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Releaseand confirm exit code 0 with no errors and no warnings treated as errors.HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csprojBuild succeededand0 Error(s).8. Verify full solution build succeeds
dotnet build HdrHistogram.sln -c Releaseand confirm exit code 0 with no errors across all four projects (HdrHistogram,HdrHistogram.Examples,HdrHistogram.UnitTests,HdrHistogram.Benchmarking).HdrHistogram.slnDirectory.Build.propschanges, if any.Build succeededand0 Error(s).9. Dry-run benchmark discovery
dotnet run --project HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Release -- --list flatand confirm BenchmarkDotNet enumerates all benchmarks without crashing.HdrHistogram.Benchmarking/Program.csLeadingZeroCountandRecordingbenchmark classes; process exits with code 0.10. Update documentation
spec/tech-standards/build-system.md, replace both occurrences of0.13.12in the BenchmarkDotNet<PackageReference>XML block with0.15.8.spec/tech-standards/build-system.mdlines 66–67grep "0.13.12" spec/tech-standards/build-system.mdreturns no matches;grep "0.15.8" spec/tech-standards/build-system.mdreturns the updated lines.Acceptance Criteria Cross-Reference
BenchmarkDotNetversion in.csprojis0.15.8BenchmarkDotNet.Diagnostics.Windowsversion in.csprojis0.15.8dotnet build HdrHistogram.Benchmarking/...csproj -c Releaseexits 0, no errorsdotnet build HdrHistogram.sln -c Releaseexits 0spec/tech-standards/build-system.mdreferences0.15.8, not0.13.12Closes #132