-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed as not planned
Closed as not planned
Copy link
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.PerformanceWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.21.1 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
Debian 12.1 with an i7-1165g7.
go env
Output
$ go env GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/alex/.cache/go-build' GOENV='/home/alex/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/alex/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/alex/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/opt/golang/go-1.21.1' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/opt/golang/go-1.21.1/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.21.1' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/home/alex/repaste_mini/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2302350423=/tmp/go-build -gno-record-gcc-switches'
What did you do?
I compiled and executed the snippet of code below.
package main
import (
"math"
"math/rand"
"runtime"
"time"
)
const (
timeLimit = 1 // timeout in minutes
timeSegment = 10 // sample rate in seconds
)
func Repaste(upTo int, done chan any) {
for i := 0; i < upTo; i++ {
select {
case <-done:
break
default:
}
_ = math.Sqrt(rand.Float64())
}
}
func main() {
lim := runtime.NumCPU()
done := make(chan any, lim)
for i := 0; i < lim; i++ {
go Repaste(math.MaxInt, done)
}
runTime := timeLimit * 60 // convert to seconds
for i := 0; i < runTime; i += timeSegment {
time.Sleep(timeSegment * time.Second)
}
for i := 0; i < lim; i++ {
done <- i
}
}
What did you expect to see?
I expected to see all 4 cores / 8 threads hit 4.1GHz during turbo boost.
NOTE: I am able to get this all-core clock speed with the exact same code snippet but built with Go 1.20.8 on the same machine, so I know it isn't a hardware issue like hitting thermal/power limits.
What did you see instead?
All cores / threads were at 100% utilization but only peaked at 3.6GHz.
It is also worth mentioning that I have tried other variations of "load" besides math.Sqrt(), such as just primitive arithmetic expressions, so this would not reflect a regression in the math package, the issue lies elsewhere.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.PerformanceWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.