Skip to content

cmd/compile: "go test" taking ~38x longer on Go tip than on Go 1.4 #14934

Closed
@mewmew

Description

@mewmew
  1. What version of Go are you using (go version)?

For Go tip

[~]$ go version
go version devel +0659cf6 Wed Mar 23 19:22:53 2016 +0000 linux/amd64

and for Go 1.4

[~]$ go version
go version go1.4.3 linux/amd64
  1. What operating system and processor architecture are you using (go env)?

For Go tip

[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc/lexer]$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/tmp/gotip"
GORACE=""
GOROOT="/home/u/go"
GOTOOLDIR="/home/u/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build981577852=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

and for Go 1.4

[/tmp/go14/src/github.com/mewmew/uc/uc/gocc/lexer]$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/tmp/go14"
GORACE=""
GOROOT="/home/u/go1.4"
GOTOOLDIR="/home/u/go1.4/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

For Go tip

[~]$ export GOPATH=/tmp/gotip
[~]$ go get github.com/mewmew/uc
[~]$ go get github.com/goccmack/gocc
[~]$ export PATH=${GOPATH}/bin:${PATH}
[~]$ cd ${GOPATH}/src/github.com/mewmew/uc
[/tmp/gotip/src/github.com/mewmew/uc]$ git checkout 9557c0010cde8953d0719ab5df170b8cfbdc3a3f
[/tmp/gotip/src/github.com/mewmew/uc]$ cd uc/gocc
[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc]$ make gen
[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc]$ cd lexer
[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test
2016/03/23 21:05:38 path: ../../testdata/incorrect/lexer/bad.c
2016/03/23 21:05:38 path: ../../testdata/incorrect/lexer/good.c
2016/03/23 21:05:38 path: ../../testdata/incorrect/lexer/long-char.c
2016/03/23 21:05:38 path: ../../testdata/incorrect/lexer/ugly.c
2016/03/23 21:05:38 path: ../../testdata/quiet/lexer/l01.c
2016/03/23 21:05:38 path: ../../testdata/quiet/lexer/l02.c
2016/03/23 21:05:38 path: ../../testdata/quiet/lexer/l03.c
2016/03/23 21:05:38 path: ../../testdata/quiet/lexer/l04.c
2016/03/23 21:05:38 path: ../../testdata/quiet/lexer/l05.c
2016/03/23 21:05:38 path: ../../testdata/quiet/lexer/l06.c
PASS
ok      github.com/mewmew/uc/uc/gocc/lexer  0.002s

real    0m20.810s
user    0m33.817s
sys 0m0.977s
[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go install

real    0m0.120s
user    0m0.113s
sys 0m0.023s
[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test
2016/03/23 21:06:18 path: ../../testdata/incorrect/lexer/bad.c
2016/03/23 21:06:18 path: ../../testdata/incorrect/lexer/good.c
2016/03/23 21:06:18 path: ../../testdata/incorrect/lexer/long-char.c
2016/03/23 21:06:18 path: ../../testdata/incorrect/lexer/ugly.c
2016/03/23 21:06:18 path: ../../testdata/quiet/lexer/l01.c
2016/03/23 21:06:18 path: ../../testdata/quiet/lexer/l02.c
2016/03/23 21:06:18 path: ../../testdata/quiet/lexer/l03.c
2016/03/23 21:06:18 path: ../../testdata/quiet/lexer/l04.c
2016/03/23 21:06:18 path: ../../testdata/quiet/lexer/l05.c
2016/03/23 21:06:18 path: ../../testdata/quiet/lexer/l06.c
PASS
ok      github.com/mewmew/uc/uc/gocc/lexer  0.001s

real    0m20.752s
user    0m34.110s
sys 0m0.953s
[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test -i

real    0m0.057s
user    0m0.030s
sys 0m0.020s
[/tmp/gotip/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test
2016/03/23 21:07:15 path: ../../testdata/incorrect/lexer/bad.c
2016/03/23 21:07:15 path: ../../testdata/incorrect/lexer/good.c
2016/03/23 21:07:15 path: ../../testdata/incorrect/lexer/long-char.c
2016/03/23 21:07:15 path: ../../testdata/incorrect/lexer/ugly.c
2016/03/23 21:07:15 path: ../../testdata/quiet/lexer/l01.c
2016/03/23 21:07:15 path: ../../testdata/quiet/lexer/l02.c
2016/03/23 21:07:15 path: ../../testdata/quiet/lexer/l03.c
2016/03/23 21:07:15 path: ../../testdata/quiet/lexer/l04.c
2016/03/23 21:07:15 path: ../../testdata/quiet/lexer/l05.c
2016/03/23 21:07:15 path: ../../testdata/quiet/lexer/l06.c
PASS
ok      github.com/mewmew/uc/uc/gocc/lexer  0.002s

real    0m20.751s
user    0m33.750s
sys 0m1.007s

and for Go 1.4

[~]$ export GOPATH=/tmp/go14
[~]$ go get github.com/mewmew/uc
[~]$ go get github.com/goccmack/gocc
[~]$ export PATH=${GOPATH}/bin:${PATH}
[~]$ cd ${GOPATH}/src/github.com/mewmew/uc
[/tmp/go14/src/github.com/mewmew/uc]$ git checkout 9557c0010cde8953d0719ab5df170b8cfbdc3a3f
[/tmp/go14/src/github.com/mewmew/uc]$ cd uc/gocc
[/tmp/go14/src/github.com/mewmew/uc/uc/gocc]$ make gen
[/tmp/go14/src/github.com/mewmew/uc/uc/gocc]$ cd lexer
[/tmp/go14/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test
2016/03/23 21:05:42 path: ../../testdata/incorrect/lexer/bad.c
2016/03/23 21:05:42 path: ../../testdata/incorrect/lexer/good.c
2016/03/23 21:05:42 path: ../../testdata/incorrect/lexer/long-char.c
2016/03/23 21:05:42 path: ../../testdata/incorrect/lexer/ugly.c
2016/03/23 21:05:42 path: ../../testdata/quiet/lexer/l01.c
2016/03/23 21:05:42 path: ../../testdata/quiet/lexer/l02.c
2016/03/23 21:05:42 path: ../../testdata/quiet/lexer/l03.c
2016/03/23 21:05:42 path: ../../testdata/quiet/lexer/l04.c
2016/03/23 21:05:42 path: ../../testdata/quiet/lexer/l05.c
2016/03/23 21:05:42 path: ../../testdata/quiet/lexer/l06.c
PASS
ok      github.com/mewmew/uc/uc/gocc/lexer  0.002s

real    0m0.588s
user    0m0.503s
sys 0m0.053s
[/tmp/go14/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go install

real    0m0.053s
user    0m0.040s
sys 0m0.007s
[/tmp/go14/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test
2016/03/23 21:06:43 path: ../../testdata/incorrect/lexer/bad.c
2016/03/23 21:06:43 path: ../../testdata/incorrect/lexer/good.c
2016/03/23 21:06:43 path: ../../testdata/incorrect/lexer/long-char.c
2016/03/23 21:06:43 path: ../../testdata/incorrect/lexer/ugly.c
2016/03/23 21:06:43 path: ../../testdata/quiet/lexer/l01.c
2016/03/23 21:06:43 path: ../../testdata/quiet/lexer/l02.c
2016/03/23 21:06:43 path: ../../testdata/quiet/lexer/l03.c
2016/03/23 21:06:43 path: ../../testdata/quiet/lexer/l04.c
2016/03/23 21:06:43 path: ../../testdata/quiet/lexer/l05.c
2016/03/23 21:06:43 path: ../../testdata/quiet/lexer/l06.c
PASS
ok      github.com/mewmew/uc/uc/gocc/lexer  0.002s

real    0m0.547s
user    0m0.483s
sys 0m0.057s
[/tmp/go14/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test -i

real    0m0.034s
user    0m0.033s
sys 0m0.000s
[/tmp/go14/src/github.com/mewmew/uc/uc/gocc/lexer]$ time go test
2016/03/23 21:06:52 path: ../../testdata/incorrect/lexer/bad.c
2016/03/23 21:06:52 path: ../../testdata/incorrect/lexer/good.c
2016/03/23 21:06:52 path: ../../testdata/incorrect/lexer/long-char.c
2016/03/23 21:06:52 path: ../../testdata/incorrect/lexer/ugly.c
2016/03/23 21:06:52 path: ../../testdata/quiet/lexer/l01.c
2016/03/23 21:06:52 path: ../../testdata/quiet/lexer/l02.c
2016/03/23 21:06:52 path: ../../testdata/quiet/lexer/l03.c
2016/03/23 21:06:52 path: ../../testdata/quiet/lexer/l04.c
2016/03/23 21:06:52 path: ../../testdata/quiet/lexer/l05.c
2016/03/23 21:06:52 path: ../../testdata/quiet/lexer/l06.c
PASS
ok      github.com/mewmew/uc/uc/gocc/lexer  0.002s

real    0m0.545s
user    0m0.503s
sys 0m0.037s
  1. What did you expect to see?

The time take by go test github.com/mewmew/uc/uc/gocc/lexer taking roughly the same amount of time to run when using Go tip and Go 1.4.

  1. What did you see instead?

"go test" took roughly 20 seconds on Go tip and 0.5 seconds on Go 1.4.

Also note that the compile command used between 25% to 60% of the CPU, during the 20 second duration.

CPU usage

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.ToolSpeed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions