Skip to content

testing: lost ns/op precision for fast benchmarks [regression] #30997

@josharian

Description

@josharian

CL 166717 caused a regression in benchmark ns/op printing precision.

We now get benchmark output like:

BenchmarkFast-8     	380491575	         3.00 ns/op

Previously, we got:

BenchmarkFast-8     	380491575	         3.12 ns/op

This is due to a change in BenchmarkResult.String. Previously, when ns/op was small, it recalculated it to get extra precision and had special print handling. Now it always uses the results of BenchmarkResult.NsPerOp, which returns an int64.

cc @aclements

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions