I'm trying to benchmark a custom map type. I basically want to see how long it takes to look up random keys.
To do so, I'm generating random keys in the state.KeepRunning() loop. I obviously don't want the random key generation to be added to the overall time of the benchmark. To prevent this, I tried to use state.PauseTiming() and state.ResumeTiming(), but I found using those functions added 100s of nanoseconds to my benchmark -- which is much more than the map lookup itself.
Is this a problem with these functions? Or should I be generating my keys a different way?