-
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: optimize compile speed by checking public symbol #15569
Comments
How could the compiler know that the changes to util2
doesn't affect util without looking at uitl?
|
When util2 compile ,it will generate a file name util2.symbol which contains all util2 public symbol NextTime when util2 source change,generate a new util2.symbol If the new util2.symbol is equal to old util2.symbol, never recompile util.go and never generate util.a |
You can looing at util.go ,but no need to generate util.a |
There are some changes that do not change public symbols and won't be visible without re-compilation. A bit artificial example: https://play.golang.org/p/_OL9rbTUpM vs https://play.golang.org/p/Rbg4Z94bAA (public symbols stayed the same but value of Y is different). I am sure that this is not the only example. |
@kostya-sh Because Y is a constants,so Y name and value will write to util.symbol,so if Y name or value change, public symbol is change too。 |
util could inline functions exported from util2, and the inlined
function might access to unexported types/constants and
functions in util2, so even if only private (non-exported) symbols
changes, util might still need to be recompiled.
The real problem here is it's just too much work to determine
that for the changed util2 package, util doesn't need to be
recompiled. It's safer to just recompile everything that directly
or indirectly depends on the changed package.
This kind of optimization is certainly nice to have, but I think
they're just too hard to get right and the benefit is not as big
as you might expect anyway (parsing and typechecking the
util package to determine if it needs to be recompiled is
non-trivial too.)
|
I agree with @minux. I don't think we're going to do anything here. Others are working on many aspects of the compiler speed already. |
Isn't it true that a package's output only depends on its source files and the export data of its dependencies? So if a dependency's source code changes, but the export data stays the same, then the output of the current package would also stay the same? Because the compiler still has the same input. It can't be that simple, but right now it sounds to me like a checksum across the export data could do the trick. @minux I see your point with the inlined function. However, does the compiler do cross-package inlining at the compile step or at the linker step? |
@neelance We try to avoid holding discussions on closed issues where nobody will see them. This is a good topic for the golang-dev mailing list. Thanks. |
cmd/compile: optimize compile speed by checking public symbol
Please answer these questions before submitting your issue. Thanks!
go version
)?go env
)?If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
I write a main.go
I write a util/util.go
I write a util2/util2.go
And Now, I just modify mmInpement code
util2.go never modify it's public symbol and interface, it just modify implement,but all file which depend on util2.go will recompile
I think the compiler should improve the compilation speed by checking whether the depend interface is changed.If the depend package is only changed implement, without changing the interface, then the package should not be re compiled.
We now have a relatively large project, when we modify the bottom module(just modify implement,no interface), all of the file depend on this module will be re compiled, resulting in a very very slow compile time
The text was updated successfully, but these errors were encountered: