From: Dave Cheney Date: Tue, 24 Feb 2015 23:59:20 +0000 (+1100) Subject: cmd/dist: respect runtime.NumCPU when bootstrapping arm hosts X-Git-Tag: go1.5beta1~1897 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7ce02613870a67f26055836ded66591be148b82b;p=gostls13.git 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 --- 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 +}