We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version devel go1.25-5eaeb7b455 Thu Apr 3 15:36:36 2025 -0700 linux/amd64
go env
AR='ar' CC='gcc' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' CXX='g++' GCCGO='gccgo' GO111MODULE='on' GOAMD64='v1' GOARCH='amd64' GOAUTH='netrc' GOBIN='' GOCACHE='/home/user/.cache/go-build' GOCACHEPROG='' GODEBUG='' GOENV='/home/user/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFIPS140='off' GOFLAGS='' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1699666494=/tmp/go-build -gno-record-gcc-switches' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMOD='/tmp/bench-loop-rangefunc/go.mod' GOMODCACHE='/home/user/golang/pkg/mod' GOOS='linux' GOPATH='/home/user/golang' GOPRIVATE='' GOPROXY='https://proxy.golang.org' GOROOT='/home/user/go-dev' GOSUMDB='sum.golang.org' GOTELEMETRY='on' GOTELEMETRYDIR='/home/user/.config/go/telemetry' GOTMPDIR='' GOTOOLCHAIN='local' GOTOOLDIR='/home/user/go-dev/pkg/tool/linux_amd64' GOVCS='' GOVERSION='devel go1.25-5eaeb7b455 Thu Apr 3 15:36:36 2025 -0700' GOWORK='' PKG_CONFIG='pkg-config'
Convert an old style benchmark loop containing a range-func loop to the new B.Loop construct.
B.Loop
Example benchmark: https://go.dev/play/p/TMQqkLTVnxB
goos: linux goarch: amd64 pkg: bench cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz BenchmarkIterRangeFunc-8 307616280 3.897 ns/op BenchmarkLoopRangeFunc-8 13051561 96.68 ns/op PASS ok bench 2.861s
The timing result should be roughly similar for both benchmarks, but instead there is a fairly severe performance reduction with B.Loop (25x).
This appears to be a good example of something to fix so B.Loop is more reliable and useful as per #73137 (comment).
The text was updated successfully, but these errors were encountered:
Cc @aclements
Sorry, something went wrong.
cc @JunyangShao @dr2chase @golang/runtime
Thanks. This is a good example of the problem in #73137. Let's track the work in that issue.
Related Issues
Related Discussions
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
No branches or pull requests
Go version
go version devel go1.25-5eaeb7b455 Thu Apr 3 15:36:36 2025 -0700 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Convert an old style benchmark loop containing a range-func loop to the new
B.Loop
construct.Example benchmark: https://go.dev/play/p/TMQqkLTVnxB
What did you see happen?
What did you expect to see?
The timing result should be roughly similar for both benchmarks, but instead there is a fairly severe performance reduction with
B.Loop
(25x).This appears to be a good example of something to fix so
B.Loop
is more reliable and useful as per #73137 (comment).The text was updated successfully, but these errors were encountered: