Navigation Menu

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
Closed

testing: benchmark results can be dropped entirely (regression) #31005

cespare opened this issue Mar 22, 2019 · 2 comments

Comments

@cespare
Copy link
Contributor

cespare 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
Copy link
Member

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
Copy link

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

@golang golang locked and limited conversation to collaborators Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants