Skip to content
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 results can be dropped entirely (regression) #31005

Closed
cespare opened this issue Mar 22, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@cespare
Copy link
Contributor

commented Mar 22, 2019

This is related to #30997.

CL 166717 caused another, slightly different regression: in some cases, the ns/op number can be dropped entirely from the output.

Example (taken from the repro case in #30928):

package foo

import (
	"testing"
	"time"
)

func BenchmarkFoo(b *testing.B) {
	for j := 0; j < b.N; j++ {
		time.Sleep(time.Millisecond)
	}
}

func BenchmarkBar(b *testing.B) {
	for j := 0; j < b.N; j++ {

	}
}

Before CL 166717:

goos: linux
goarch: amd64
BenchmarkFoo-8              2000           1183420 ns/op
BenchmarkBar-8          2000000000               0.23 ns/op
PASS

After CL 166717:

goos: linux
goarch: amd64
BenchmarkFoo-8              2000           1182313 ns/op
BenchmarkBar-8          2000000000
PASS

cc @aclements @josharian

@aclements if you're busy, I can send a CL for these issues.

@aclements

This comment has been minimized.

Copy link
Member

commented Mar 22, 2019

The fix I just sent for #30997 should also fix this.

Unfortunately, I'm not sure there's a good way to reliably test this. I bet some of the builders are slow enough that you can't produce a ns/op value < 1.

@gopherbot

This comment has been minimized.

Copy link

commented Mar 22, 2019

Change https://golang.org/cl/168937 mentions this issue: testing: fix fractional ns/op printing

@gopherbot gopherbot closed this in 1257d05 Mar 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.