|
| 1 | +# Issue #132: Upgrade BenchmarkDotNet from 0.13.12 to 0.15.8 |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +The benchmarking project (`HdrHistogram.Benchmarking`) currently references BenchmarkDotNet **0.13.12**. |
| 6 | +The target version is **0.15.8**. |
| 7 | +Both `BenchmarkDotNet` and `BenchmarkDotNet.Diagnostics.Windows` must be updated together, as they are companion packages that must always share the same version. |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +## Affected Files |
| 12 | + |
| 13 | +The following files are confirmed by exploration: |
| 14 | + |
| 15 | +### Primary change |
| 16 | + |
| 17 | +- `HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj` — contains the two `<PackageReference>` elements to update from `0.13.12` to `0.15.8`. |
| 18 | + |
| 19 | +### Source files that import BenchmarkDotNet APIs (may need fixes if breaking changes exist) |
| 20 | + |
| 21 | +- `HdrHistogram.Benchmarking/Program.cs` — runner entry point; uses `BenchmarkSwitcher` / `BenchmarkRunner` configuration. |
| 22 | +- `HdrHistogram.Benchmarking/LeadingZeroCount/LeadingZeroCountBenchmarkBase.cs` — base class with `[Benchmark]` attributes and benchmark methods. |
| 23 | +- `HdrHistogram.Benchmarking/Recording/Recording32BitBenchmark.cs` — benchmark class with `[Benchmark]` attributes. |
| 24 | + |
| 25 | +### Documentation that records the version number |
| 26 | + |
| 27 | +- `spec/tech-standards/build-system.md` — lists `BenchmarkDotNet` version `0.13.12` in the Dependencies section; must be updated to `0.15.8` after the code change is verified. |
| 28 | + |
| 29 | +## What Needs to Change |
| 30 | + |
| 31 | +1. In `HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj`, change both package versions from `0.13.12` to `0.15.8`. |
| 32 | +2. Resolve any breaking-change compilation errors or new Roslyn analyser warnings that are emitted as errors under the existing `<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>` and `<AnalysisLevel>latest-recommended</AnalysisLevel>` settings inherited from `Directory.Build.props`. |
| 33 | +3. Update `spec/tech-standards/build-system.md` to record the new version. |
| 34 | + |
| 35 | +## Acceptance Criteria |
| 36 | + |
| 37 | +- [ ] `BenchmarkDotNet` version in `HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj` is `0.15.8`. |
| 38 | +- [ ] `BenchmarkDotNet.Diagnostics.Windows` version in the same file is `0.15.8`. |
| 39 | +- [ ] `dotnet build HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Release` exits with code 0 and no errors or warnings treated as errors. |
| 40 | +- [ ] `dotnet build HdrHistogram.sln -c Release` exits with code 0 (full solution build is clean). |
| 41 | +- [ ] `spec/tech-standards/build-system.md` no longer references `0.13.12`; it references `0.15.8` instead. |
| 42 | +- [ ] No existing benchmark class logic is changed unless forced by a BenchmarkDotNet API breaking change. |
| 43 | + |
| 44 | +## Test Strategy |
| 45 | + |
| 46 | +BenchmarkDotNet is a developer tool, not shipped library code, so there are no unit tests to add or modify. |
| 47 | +Verification is build-based: |
| 48 | + |
| 49 | +1. Run `dotnet restore HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj` to pull the new packages. |
| 50 | +2. Run `dotnet build HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj -c Release` and confirm zero errors and zero warnings-as-errors. |
| 51 | +3. Run `dotnet build HdrHistogram.sln -c Release` to confirm the full solution still compiles cleanly. |
| 52 | +4. Optionally run `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. |
| 53 | + |
| 54 | +No new test files are required. |
| 55 | + |
| 56 | +## Risks and Open Questions |
| 57 | + |
| 58 | +### Breaking changes (two-minor-version jump) |
| 59 | + |
| 60 | +BenchmarkDotNet follows semantic versioning loosely. |
| 61 | +The 0.14.x series and 0.15.x series may contain breaking changes to public configuration APIs used in `Program.cs`. |
| 62 | +The `BenchmarkRunner.Run` / `BenchmarkSwitcher.FromAssembly` surface is historically stable, but job/column/exporter configuration APIs have changed in the past. |
| 63 | +Risk: **low to medium** — inspect compiler output after the version bump to surface any issues. |
| 64 | + |
| 65 | +### New Roslyn analysers |
| 66 | + |
| 67 | +BenchmarkDotNet 0.15.x ships new compile-time analysers. |
| 68 | +Under `<AnalysisLevel>latest-recommended</AnalysisLevel>` and `<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>` (set in `Directory.Build.props`), new analyser warnings may be promoted to errors. |
| 69 | +If this occurs, the benchmark source files must be corrected to satisfy the analysers. |
| 70 | +Risk: **low** — the existing benchmark code is simple and unlikely to trigger new rules. |
| 71 | + |
| 72 | +### `BenchmarkDotNet.Diagnostics.Windows` on non-Windows |
| 73 | + |
| 74 | +`BenchmarkDotNet.Diagnostics.Windows` is a conditional dependency. |
| 75 | +On Linux (WSL2, CI), the package must still restore and build without error even though its ETW-based diagnostics cannot run. |
| 76 | +BenchmarkDotNet has historically handled this gracefully; no change is expected. |
| 77 | +Risk: **very low**. |
| 78 | + |
| 79 | +### `spec/tech-standards/build-system.md` drift |
| 80 | + |
| 81 | +The spec file hard-codes the package version. |
| 82 | +It must be updated as part of this issue to prevent stale documentation. |
| 83 | +This is a documentation-only risk; no code impact. |
0 commit comments