Skip to content
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: build the cgo artifacts for each package in parallel #9887

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

Comments

Projects
None yet
6 participants
@petermattis
Copy link

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 "go build" doesn't parallelize compilations within a package cmd/go: "go build" doesn't parallelize compilations within a package Feb 16, 2015

@robpike

This comment has been minimized.

Copy link
Contributor

robpike commented Feb 16, 2015

Seems reasonable to me. Why not send the patch?

@petermattis

This comment has been minimized.

Copy link
Author

petermattis commented Feb 16, 2015

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

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Apr 25, 2015

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

@petermattis

This comment has been minimized.

Copy link
Author

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.

@bcmills bcmills changed the title cmd/go: "go build" doesn't parallelize compilations within a package cmd/go: build the cgo artifacts for each package in parallel Jan 23, 2019

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jan 23, 2019

Contrast #21605. Are there any similar ordering issues for other languages?

@bcmills bcmills added the ToolSpeed label Jan 23, 2019

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Jan 23, 2019

Currently we only support C, C++, and Fortran, and C and C++ have no ordering issues.

I'm not aware of ordering issues for any other language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.