-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: GO19CONCURRENTCOMPILATION not working as expected #21236
Comments
I just realized the time GO19CONCURRENTCOMPILATION=0 go1.9rc1 build -gcflags=-c=1 -o ponzu-server cmd/ponzu/*.go
GO19CONCURRENTCOMPILATION=0 go1.9rc1 build -gcflags=-c=1 -o ponzu-server 1.50s user 0.16s system 132% cpu 1.259 total
# ---
time GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -gcflags=-c=1 -o ponzu-server cmd/ponzu/*.go
GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -gcflags=-c=1 -o ponzu-server 1.48s user 0.19s system 132% cpu 1.255 total
# ---
time GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -gcflags=-c=2 -o ponzu-server cmd/ponzu/*.go
GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -gcflags=-c=2 -o ponzu-server 1.74s user 0.14s system 139% cpu 1.346 total
# ---
time GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -gcflags=-c=4 -o ponzu-server cmd/ponzu/*.go
GO19CONCURRENTCOMPILATION=1 go1.9rc1 build -gcflags=-c=4 -o ponzu-server 1.71s user 0.19s system 113% cpu 1.680 total UPDATE: Though, I'm unclear if the > 100% cpu usage reported above when |
Assigning to @josharian . We can still get doc changes into 1.9 if appropriate. |
Thanks for the report. I took a look at package
This will tell you the individual toolchain commands being run and time them individually, and then print an overall total. On my machine, I see concurrent compilation taking ~0.09s and non-concurrent compilation taking ~0.14s. Linking takes about 0.65s. There's another 0.25s spend in the As for the place where "nBackendWorkers is set to 1", that's addressed in change 41503, which was intentionally held for 1.10. But it's not obvious to me that that is an important factor in this case. If you want to experiment, or if that change makes your life much better now, feel free to cherry-pick that change and rebuild the toolchain. So I think everything is working as intended here. I don't see any obvious doc changes to make, although I'm open to suggestions. For now, I'm going to close this, but will re-open if there's new information or suggestions. |
That's cool. Wasn't aware of this -- thanks for pointing it out.
I see -- thank you for pointing this out as well. I couldn't tell how much of each package could be compiled before the This was reported entirely out of experimentation, and I hope it didn't cause you many wasted cycles 😬 .. figured I would share what I was seeing before 1.9 hits master. The concurrent compilation is a great feature - thank you for your work on it!! If I have any doc suggestions pre 1.10, I will report back here. |
FWIW, this makes a noticeable difference in (generally autogenerated) packages that define thousands of types.
Appreciated! Very glad you're kicking the tires. |
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?
vs.
If possible, provide a recipe for reproducing the error.
This was tested with github.com/ponzu-cms/ponzu by running:
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?
It appears that there is no difference with or without GO19CONCURRENTCOMPILATION feature,
and after looking through(it's here... )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 thebuild
command with either of these flags explicitly set causes a failure:flag provided but not defined: -C
orflag provided but not defined: -c
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!
The text was updated successfully, but these errors were encountered: