Speed up Package.getPackageConfigs#2902
Merged
dlang-bot merged 2 commits intodlang:masterfrom Apr 20, 2024
Merged
Conversation
The only package that can have a config already created is the root package, and only if the `config` parameter isn't an empty string. Every other package is in the `configs` array iff it was added by a previous call to this function. The exact same configurations will be found if this function is called again for the same (p, c) pair and it will do needless work that won't modify anything.
|
✅ PR OK, no changes in deprecations or warnings Total deprecations: 0 Total warnings: 0 Build statistics: statistics (-before, +after)
-executable size=5347800 bin/dub
-rough build time=64s
+executable size=5364184 bin/dub
+rough build time=63sFull build output |
kinke
added a commit
to symmetryinvestments/reggae
that referenced
this pull request
Apr 19, 2024
Cherry-picking dlang/dub#2902.
thewilsonator
approved these changes
Apr 20, 2024
Member
|
Looks good as far as I can see. Two additional things caught my eye:
|
Member
|
Turns out there is actually code that mutates the dependencies of a |
Contributor
Author
|
I considered speeding up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Package.getPackageConfigswas taking 3 seconds for a particular dub package, which was made worse by the fact it was called multiple times with different arguments. The changes in this PR bring it down to just under 200ms, which IMHO is still slow.Investigating led me to realise that
determineDependencyConfigswas being called over and over again for the exact same packages, especially common dependencies likemir-algorithmandunit-threaded. This PR does two things:First, it makes the array of package dependencies smaller via
.sort.uniq. This cut down the time by half to 1.5s.Secondly, after taking a while to understand the inner workings of the function, it returns early for packages that have already been analysed. This brought it further down to the 100ms range.