golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.95k stars 17.66k forks source link

runtime: fractional worker preemption causes performance degradation for single cpu #22693

Open TocarIP opened 6 years ago

TocarIP commented 6 years ago

What version of Go are you using (go version)?

go version devel +ef0e2af Mon Nov 6 15:55:31 2017 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/nfs/site/home/itocar/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/localdisk/itocar/gopath/"
GORACE=""
GOROOT="/localdisk/itocar/golang"
GOTMPDIR=""
GOTOOLDIR="/localdisk/itocar/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build447443283=/tmp/go-build -gno-record-gcc-switches"

/proc/cpuinfo: model name : Intel(R) Xeon(R) CPU E5-2609 v3 @ 1.90GHz

What did you do?

I've compared performance of 1.9 vs trunk on builtin benchmarks with -cpu=1 and found that some of them have regressed. Changes in performance were bisected to 28e1a8e47aa089e781aa15bdd16e15265a5180bd which caused:

cmd/compile/internal/ssa/Fuse/10000 33.2ms ± 2% 38.1ms ± 2% +14.62% text/template/parse/ParseLarge 43.2ms ± 1% 49.1ms ± 2% +13.60% (p=0.000 n=8+8)

This is reproducible only with go test -cpu=1 -bench=...... I doubt that -cpu=1 case is important, but CL message didn't mention performance impact, so I'm opening this.

TocarIP commented 6 years ago

cc @aclements