-
Notifications
You must be signed in to change notification settings - Fork 570
Refactor build package #411
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
Conversation
CI is failing. :( |
Will review, but first, a question.
Can you elaborate on what you mean? My understanding of /vendor/ was previously mistaken, and I would've said the same thing. But by now I think there's a very direct mapping between import path (original with /vendor/ prefix kept) and build packages. |
What I mean is that there are two different versions of the import path now:
|
Got it, that makes sense. On a side note, we need to come up with good terminology to differentiate those 2 types of import paths. :/ There's now a relative import path (e.g., "./foo/bar"), a full import path ("example.com/user/repo/foo/bar"), and a... even more full import path ("example.com/user/otherrepo/baz/vendor/example.com/user/repo/foo/bar")... |
Reviewed, see comments/questions above. This is definitely an improvement in data organization. Although a lot of this code can go away once we're using LGTM, but read my comments. Two things after merging this (I will do):
|
@shurcooL Thx! |
There seems to be a regression with compilation times. Compiling https://github.com/shurcooL/eX0/tree/master/eX0-go#readme with previous version:
0.6 seconds on average. After updating:
First time it takes longer because all dependencies need to be rebuilt since |
I've noticed a similar significant compilation time increase in The Go package above doesn't use /vendor/ anywhere. Any ideas why it'd get slower? Edit: It may use /vendor/ by importing |
This is probably because it is calling https://golang.org/pkg/go/build/#Context.Import much more often. This is necessary because this function resolves vendored packages. We may add caching so we only do it once for every dependency of a package instead of for each import statement in each file of the package. |
Makes sense. Shall we open an issue to track that? |
An alternative to consider is reverting this change, to keep working on it on a branch until we're happy with performance, and merge it then. We can use the Go profiler to profile compilation time and more easily find out where the bottlenecks are. |
Please test if #413 improves the situation. |
Revert: No, because this fixed bugs. My initial vendoring implementation was not correct. I'd rather have it slower than broken. |
Agreed. #413 makes a significant improvement, but it's not 1:1 with original performance. It's definitely good enough to proceed with this and consider optimizing later on. goReadersToJs taken: 3.971618929s - before 411 |
Cool, I'll merge it. |
Because of vendoring, there is no strict mapping between import path -> PackageData -> Archive any more. I'm trying to address the situation in this changeset. Might be related to #409. I'm still not entirely happy, but it improves the situation a bit.
@shurcooL PTAL. Hopefully your go tool project will enable us to throw away this code (or at least not use it in the gopherjs binary any more ... some parts could be kept in a separate library as a helper).