Cache packages
field, which is used by DefaultExternalLocationProvider.resolve
#4009
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.
Found and tested on https://github.com/rjaros/kilua (results are reproducible even after several runs).
Reduces allocations inside DefaultExternalLocationProvider.resolve from 11 GB to 1 GB. Previously
packages
were recreated for eachresolve
.The changes don't really affect kotlinx.io and kotlinx.coroutines.
For future: probably it might make sense to also cache results of
DefaultExternalLocationProvider.resolve
?In this specific project there are a lot of references to
@Composable
annotation passing through this function call.