Writing

Before you benchmark anything in .NET, run A against A

The same code, timed against itself, came out 19.99% apart. Until you know that number for your harness, you can't read a 20% win.

10 Sept 2026 · Updated 2 Oct 2026 · 3 min · Ernest

Measurement

Before I changed anything in Weft's benchmark harness, I ran the dullest experiment I know: the same code and the same configuration, split into two arms and timed as if one were the candidate and the other the baseline. They came out 19.99% apart.

Nothing differed between them, so that 20% was the harness. The true difference in an A/A run is zero, and whatever gap you get is your noise floor.

The setting that mattered was tiered compilation. .NET compiles a quick first version of your code and re-JITs the hot parts later, so the code you're timing can change underneath you partway through a run. With tiering off, the same control came out 0.06% to 0.21% apart.

Runtime settingGap between identical arms
default tiering14.79% to 19.99% (three of four machines)
DOTNET_TieredCompilation=00.06% to 0.21%
One configuration measured against itself on .NET 10, AMD machines. These are gaps between two identical arms, not speeds.

With tiering on, a real 20% effect and no effect at all look the same to this harness. Every sub-20% result I'd have reported before running that control isn't necessarily wrong. It's unreadable, which is worse.

It wasn't the only thing wrong with the harness that month. It had also been making a 4.24 ns kernel read as 15.16 ns, by allocating 24 bytes per call inside the timed region. That one has its own lab note.

Before you trust a number

  • Run A against A first. Same method, same inputs, two arms. That gap is your floor.
  • If the floor is wide, try it again with DOTNET_TieredCompilation=0.
  • Make the benchmark report allocations, and expect zero inside the timed region.
  • Anything under the floor isn't a result. Don't rerun it until it becomes one.