-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing: Benchmark shows zero allocations #20863
Comments
It turns out that it prints memory statistics when b.ReportAllocs is called. |
This is already documented
http://tip.golang.org/pkg/testing/#BenchmarkResult but if it was changed in go1.9 then I agree it's worth mentioning in release notes, too. |
The change was introduced in https://go-review.googlesource.com/c/36791/ |
CL https://golang.org/cl/47331 mentions this issue. |
@ALTree I would rather revert CL 36791 now that ReadMemStats is fast (see https://tip.golang.org/doc/go1.9#gc). I'll send a CL. |
/cc @josharian @aclements |
I thought this was fixed a few days ago by https://golang.org/cl/46612? |
Yeah, I was just about to point that out. Looks like that only reverted 1 of the 3 spots. |
CL https://golang.org/cl/47350 mentions this issue. |
Ah, thanks for noticing. I didn't notice that that change was partly reverted. |
testing.Benchmark does not seem to produce valid memory stats any more:
The following program:
always prints:
I'd expect it to print
like previous Go versions.
go version devel +eab99a8 Mon Jun 26 21:12:22 2017 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: