Skip to content

cmd/compile: GO19CONCURRENTCOMPILATION not working as expected #21236

@nilslice

Description

@nilslice

Please answer these questions before submitting your issue. Thanks!

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

go1.9rc1

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

linux/amd64

What did you do?

time GO19CONCURRENTCOMPILATION=1 go1.9rc1 build ./*.go

vs.

time GO19CONCURRENTCOMPILATION=0 go1.9rc1 build ./*.go"

If possible, provide a recipe for reproducing the error.

This was tested with github.com/ponzu-cms/ponzu by running:

$ go get github.com/ponzu-cms/ponzu/...
$ ponzu new github.com/nilslice/go19test
$ cd $GOPATH/src/github.com/nilslice/go19test
$ time GO19CONCURRENTCOMPILATION=0 ponzu build --gocmd=go1.9rc1
# (equal to: time GO19CONCURRENTCOMPILATION=0 go1.9rc1 build cmd/ponzu/*.go)
# vs.
$ time GO19CONCURRENTCOMPILATION=1 ponzu build --gocmd=go1.9rc1
# vs.
$ time ponzu build # with go 1.8.3

A link on play.golang.org is best.

What did you expect to see?

I expected to see the build time / CPU usage change more dramatically when toggling concurrent compilation with the GO19CONCURRENTCOMPILATION var set/unset.

What did you see instead?

# go 1.9 with concurrent compilation
time GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -o ponzu-server cmd/ponzu/*.go
GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -o ponzu-server cmd/ponzu/*.go  8.62s user 0.43s system 249% cpu 3.628 total
# ---

# go 1.9 without concurrent comilation
time GO19CONCURRENTCOMPILATION=0 go1.9rc1 build -o ponzu-server cmd/ponzu/*.go
GO19CONCURRENTCOMPILATION=0 go1.9rc1 build -o ponzu-server cmd/ponzu/*.go  8.80s user 0.51s system 245% cpu 3.787 total
# ---

# go 1.8.3
time ponzu build # with go1.8.3 linux/amd64                                        
ponzu build  17.48s user 0.96s system 278% cpu 6.630 total

It appears that there is no difference with or without GO19CONCURRENTCOMPILATION feature, and after looking through go/internal/work/build.go, it seems that the -C or -c flag is not defined, which the surrounding code suggests it would influence the parallel build. In fact, running the build command with either of these flags explicitly set causes a failure: flag provided but not defined: -C or flag provided but not defined: -c (it's here... )

I may have this all wrong, and I couldn't create a more concurrent-happy build (so it may just be that parallel compilation doesn't help me much), but I thought I'd still report what I dug up!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions