benchmark

Explain how b.N is determined.

  1. func BenchmarkFib10(b *testing.B) {
  2. for n := 0; n < b.N; n++ {
  3. Fib(10)
  4. }
  5. }

Answer

  1. The value of b.N will increase each time until the benchmark runner is satisfied with the stability of the benchmark.