Go 1.24 has testing.B.Loop. My important little benchmark means to look up "stove" in a dictionary. Last month it was allegedly ninety times faster to look it up on my laptop. Got an uncomfortable question about how many dictionaries I opened.
Old measured loop reopened on each lookup. New one opens once before for b.Loop() { lookup(dict, "stove") }. Counting opens tells me first one did N loads, second one did one. Stop congratulating my processor pls.
So the claimed speedup compared different work. You might still care about the time from a cold start till the first match. Could you keep that as a second benchmark with opening INSIDE, instead of deleting the number because it's embarrassing?
kept Lookup and OpenThenLookup. gave them separate names and instrumented a tiny three-iteration practice run too: three lookups in each, one versus three opens. the spare counter isn't in the timed version.
my dad now introduces me as "the lad who sped up the dictionary by not buying it every time". which sounds like real bloody progress in his line of work.