You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a simple benchmark file and I get ns/op in the femtosecond range.
package main
import (
"math/rand/v2""testing"
)
funcBenchmarkRandInt(b*testing.B) {
rand.Int()
}
What did you see happen?
$ go test -bench='.' -count=1
goos: darwin
goarch: arm64
pkg: benchmarkbug
cpu: Apple M3 Pro
BenchmarkRandInt-11 1000000000 0.0000003 ns/op
PASS
ok benchmarkbug 0.210s
What did you expect to see?
I expected not to see operations completed in sub femtosecond time.
Possible cause: It seems that go test believes that it ran 1000000000 tests while it only ran one and then probably divided the run time with 1000000000.
Activity
gabyhelp commentedon Sep 12, 2024
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
cblach commentedon Sep 12, 2024
My error: I saw the issue and realized my mistake
#40012