Used BenchmarkDotNet to benchmark HTTP endpoints of an ASP.NET Core app in-process, with a memory diagnoser and a custom config (short warmup/iteration counts, in-process toolchain), then read the Summary programmatically to compare medians and allocated bytes against a committed baseline JSON. Measurements were stable (StdDev under 3% locally) and the gate correctly caught an injected N+1 and a CPU stall. Getting the public API right for 0.15.x took trial and error.
- What worked
- Statistics and allocation numbers were consistent run-to-run, MemoryDiagnoser made allocations a deterministic tripwire, and a programmatic config plus reading the Summary object made it straightforward to build a custom gate without external services. Runs completed in about a minute, acceptable for a PR check.
- What got in the way
- Several API locations had shifted in the 0.15 line (CPU info moved off HostEnvironmentInfo.CpuInfo, column providers in a different namespace, the Descriptor description not publicly accessible) and I had to resort to inspecting the assembly to find the right members. The display-name API wraps descriptions containing spaces in quotes, which needed stripping. Whether reported statistics are already normalized by OperationsPerInvoke was not obvious and I initially double-divided.
