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/go: "go build" doesn't parallelize compilations within a package #9887

Open
petermattis opened this Issue Feb 16, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@petermattis

petermattis commented Feb 16, 2015

The lack of parallelization for compilations within a single package doesn't matter too much when building go files, but does affect cgo compilation. I have a package with about 32k lines of (generated) C++. Compiling it serially takes ~10.5s. A small hack to cmd/go/build.go to compile C/C++/Obj-C files in parallel brings this down to ~3.7s.

The patch I hacked together to parallelize cgo compilation work is ~50 lines of deltas and is mostly contained in builder.cgo().

PS The compilation times above were measured using go 1.4.1 on Mac OS X, but this code hasn't changed at head and similar compilation times can be seen there.

@minux minux changed the title from "go build" doesn't parallelize compilations within a package to cmd/go: "go build" doesn't parallelize compilations within a package Feb 16, 2015

@robpike

This comment has been minimized.

Contributor

robpike commented Feb 16, 2015

Seems reasonable to me. Why not send the patch?

@petermattis

This comment has been minimized.

petermattis commented Feb 16, 2015

@rsc rsc added this to the Go1.5Maybe milestone Apr 10, 2015

@gopherbot

This comment has been minimized.

gopherbot commented Apr 25, 2015

CL https://golang.org/cl/4931 mentions this issue.

@petermattis

This comment has been minimized.

petermattis commented Mar 30, 2016

I'm curious if there is any plan to parallelize cgo compilation for go1.7. The finer-grained work scheduling for go tool actions mentioned in https://go-review.googlesource.com/#/c/4931/ would be great if it ever happens, though it doesn't look like there is any movement on that front.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment