main: respect GOMAXPROCS environment variable
If the user sets GOMAXPROCS explicitely, we should respect it.
This commit is contained in:
parent
d5ce340c02
commit
ff210a06fb
5
main.go
5
main.go
@ -133,8 +133,9 @@ func printVersion() {
|
||||
|
||||
func main() {
|
||||
mxp := runtime.GOMAXPROCS(0)
|
||||
if mxp < 4 {
|
||||
// On a 2-core machine, setting maxprocs to 4 gives 10% better performance
|
||||
if mxp < 4 && os.Getenv("GOMAXPROCS") == "" {
|
||||
// On a 2-core machine, setting maxprocs to 4 gives 10% better performance.
|
||||
// But don't override an explicitely set GOMAXPROCS env variable.
|
||||
runtime.GOMAXPROCS(4)
|
||||
}
|
||||
// mount(1) unsets PATH. Since exec.Command does not handle this case, we set
|
||||
|
Loading…
Reference in New Issue
Block a user