Upgrade BenchmarkDotNet to 0.16.0-preview.2 and benchmark .NET 11

Merged
BR
18d ago
+28-30

Summary

Upgrades BenchmarkDotNet so the benchmarks can run on .NET 11, and drops .NET 9, which is out of support.

BenchmarkDotNet 0.15.8, the latest stable release, has no .NET 11 runtime (CoreRuntime.Core11_0). This moves to 0.16.0-preview.2, the first version with it.

Changes

  • Benchmarks project: BenchmarkDotNet and BenchmarkDotNet.Diagnostics.Windows go from 0.15.2 to 0.16.0-preview.2. Targets are now net48;net8.0;net10.0;net11.0.
  • net48 package references: System.Collections.Immutable and System.Reflection.Metadata go from 9.0.0 to 10.0.7, the minimum the new BenchmarkDotNet dependencies require. Restore fails with NU1605 otherwise.
  • FrameworkCompareConfig and VersionComparisonConfig: .NET 11 jobs added and .NET 9 jobs removed.
  • 0.16 API changes:
    • The job runtime moved from Job.Environment.Runtime to Job.Infrastructure.Runtime. Runtime.MsBuildMoniker is no longer public, so VersionComparisonOrderer sorts by Runtime.Version and groups by Runtime.Name plus Runtime.Version. In 0.16, Name alone is just ".NET", which would put every .NET runtime in one group. Results now list net48 first, then .NET 8, 10 and 11.
    • X86X64Config builds NetCoreAppSettings { CliPath = ... } and passes it to CsProjCoreToolchain.From(runtime, settings). It was pinned to the NetCoreApp50 settings and now targets .NET 10, so the 32-bit dotnet install needs the .NET 10 runtime.
  • Previous build fix (already broken on main): the Compile Remove items still named Internal\VarIntEncoding*Tests.cs. The benchmarks are now VarIntEncodingRead.cs and VarIntEncodingWrite.cs and call VarIntEncoding.TryWrite, which Snappier 1.2.0 lacks. Every Previous baseline reported NA. The item is now VarIntEncoding*.cs.
  • Tests and CI: net9.0 removed from the test project and from the x64 and ARM test matrices, along with the 9.0.x SDK install.

Testing

  • The solution builds with no errors or warnings.
  • All 1,232 tests pass locally on .NET 8, 10 and 11 and on net48.
  • A ShortRun of UnalignedCopy64 with the framework comparison config ran on .NET Framework 4.8 and .NET 8 through 11.
  • Version comparison ShortRun of DecompressAll: all 88 benchmarks ran, Previous and current, on .NET Framework 4.8 and .NET 8, 10 and 11.
  • x86/x64 ShortRun of UnalignedCopy64: the x64 job ran. The x86 job could not build on the test machine because its 32-bit dotnet install has no 11.0 SDK, which global.json requires. That is a machine setup issue, not a code issue, but x86 is still unverified.

šŸ¤– Generated with Claude Code