Last active
March 20, 2019 17:25
-
-
Save fmstephe/a23ddff062f3b96df5e634ccf21e0106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"testing" | |
) | |
/* | |
goos: darwin | |
goarch: amd64 | |
pkg: github.com/fmstephe/test_empty_method | |
BenchmarkDebugNoop-4 100000000 18.4 ns/op 8 B/op 1 allocs/op | |
BenchmarkDebugNoop_NoArgs-4 2000000000 0.42 ns/op 0 B/op 0 allocs/op | |
*/ | |
func BenchmarkDebugNoop(b *testing.B) { | |
b.ReportAllocs() | |
for i := 0; i < b.N; i++ { | |
Debugf("This does nothing %d", i) | |
} | |
} | |
func BenchmarkDebugNoop_NoArgs(b *testing.B) { | |
b.ReportAllocs() | |
for i := 0; i < b.N; i++ { | |
Debugf("This is also does nothing") | |
} | |
} | |
func Debugf(s string, a ...interface{}) {} // disable debug logs unless `debug` tag is provided |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment