Skip to content

Instantly share code, notes, and snippets.

@heat
Created August 14, 2018 18:34
Show Gist options
  • Save heat/b0e6133eda9bc29a913befa6c2e05749 to your computer and use it in GitHub Desktop.
Save heat/b0e6133eda9bc29a913befa6c2e05749 to your computer and use it in GitHub Desktop.
func benchmarkFib(i int, b *testing.B) {
for n := 0; n < b.N; n++ {
Fib(i)
}
}
func BenchmarkFib1(b *testing.B) { benchmarkFib(1, b) }
func BenchmarkFib2(b *testing.B) { benchmarkFib(2, b) }
func BenchmarkFib3(b *testing.B) { benchmarkFib(3, b) }
func BenchmarkFib10(b *testing.B) { benchmarkFib(10, b) }
func BenchmarkFib20(b *testing.B) { benchmarkFib(20, b) }
func BenchmarkFib40(b *testing.B) { benchmarkFib(40, b) }
go test -run=XXX -bench=.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment