Skip to content

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

@cespare

Description

@cespare

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions