You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
What did you expect to see?
No allocations.
What did you see instead?
Allocations. I would like the compiler to observe that the allocating args are unused and not allocate.
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, also tried it with 1.12.1
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
This benchmark allocates on every loop.
https://gist.github.com/fmstephe/a23ddff062f3b96df5e634ccf21e0106
What did you expect to see?
No allocations.
What did you see instead?
Allocations. I would like the compiler to observe that the allocating args are unused and not allocate.
The text was updated successfully, but these errors were encountered: