diff options
| author | Michael Matloob <matloob@golang.org> | 2025-11-24 18:33:30 -0500 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2025-11-26 13:48:13 -0800 |
| commit | 623ef2813579c9b52ba4a0335722df4d93566b74 (patch) | |
| tree | fc5edf04a1ce5107323a37eac774721d149d56ba /src/runtime/runtime2.go | |
| parent | 3c6bf6fbf38062b24a7cf0390f1e617d733851b3 (diff) | |
| download | go-623ef2813579c9b52ba4a0335722df4d93566b74.tar.xz | |
cmd/go: limit total compile -c backend concurrency using a pool
Previously we limited the value we passed in to compile -c (which set
the number of SSA compile goroutines that run at one time) to 4. This CL
allows the -c value to go up to GOMAXPROCS, while limiting the total
number of backend SSA compile goroutines to still be less than the
previous worst case of 4*GOMAXPROCS (actually four times the value of
the -p flag, but the default is GOMAXPROCS). We do that by keeping a
pool of tokens to represent the total number of SSA compile goroutines
(with some buffer to allow us to run out of tokens and not exceed
4*GOMAXPROCS). Each time a compile requests a -c value, we'll hand out
half of the remaining tokens (with the number handed otu capped at
GOMAXPROCS) until we run out of tokens, in wich case we'll set -c to
one.
This leads to a speed up of 3-10% on the 16 core intel perf builder and
5-16% on the 88 core builder on the Sweet go-build benchmark.
Change-Id: Ib1ec843fee57f0fb8d36a507162317276a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724142
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
0 files changed, 0 insertions, 0 deletions
