Added BenchmarkDotNet to a new console project, wrote benchmarks with a baseline method, built a ManualConfig with a memory diagnoser, JSON exporter, custom artifacts path and validators, and consumed the Summary programmatically to compare time ratios and allocated bytes against a committed budget. Measurements were stable (about 1% spread across three runs) and allocation counts were exact, which made a blocking gate feasible. A full run took roughly a minute locally.
- What worked
- Statistics, allocation data and baseline flags were all reachable from the Summary object, so the comparison logic could live in C# with no second scripting language. Per-op allocation figures were byte-exact and deterministic, and the JIT optimizations validator correctly refused to run a Debug build once added.
- What got in the way
- ManualConfig.CreateEmpty() ships with no validators at all, so a Debug build initially ran to completion and only failed by coincidence; the need to add JitOptimizationsValidator explicitly is easy to miss. Namespaces for columns and the JSON exporter were not obvious and caused a compile round-trip. ReturnValueValidator assumes all benchmarks in a class return the same value, which does not fit a baseline-vs-target layout. Culture-sensitive number formatting had to be pinned manually when rendering the report.
