From 7ce02613870a67f26055836ded66591be148b82b Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Wed, 25 Feb 2015 10:59:20 +1100 Subject: [PATCH] cmd/dist: respect runtime.NumCPU when bootstrapping arm hosts This is a reproposal of CL 2957. This reproposal restricts the scope of this change to just arm systems. With respect to rsc's comments on 2957, on all my arm hosts they perform the build significantly faster with this change in place. Change-Id: Ie09be1a73d5bb777ec5bca3ba93ba73d5612d141 Reviewed-on: https://go-review.googlesource.com/5834 Reviewed-by: Brad Fitzpatrick --- src/cmd/dist/util.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go index 12e14d3ae5..d7e0078c2f 100644 --- a/src/cmd/dist/util.go +++ b/src/cmd/dist/util.go @@ -436,7 +436,7 @@ func main() { } if gohostarch == "arm" { - maxbg = 1 + maxbg = min(maxbg, runtime.NumCPU()) } bginit() @@ -544,3 +544,10 @@ func xgetgoarm() string { } return goarm } + +func min(a, b int) int { + if a < b { + return a + } + return b +} -- 2.48.1