feat: cache parsing results of current dependency files#342
Merged
Conversation
This change speeds up overall execution time, especially for manifests. It does this by caching the results of parsing dependency files from the current (HEAD) location under analysis.
* Rename the `phylum.ci.lockfile` module to `phylum.ci.depfile` * Rename the `Lockfile` class to `Depfile` * Change internal naming uses of "lockfile" to "depfile" * Change text/comment uses of "lockfile" to "dependency file" * Keep the instances where Phylum CLI still uses "lockfile" naming * Related names are similarly unchanged, to stay consistent * These may be changed if/when the CLI changes to "depfile" language
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.
This change speeds up overall execution time, especially for manifests.
It does this by caching the results of parsing dependency files from the
current (HEAD) location under analysis. This reduces the instances of
parsing the same file from three to two. Previously, it would happen:
--force-analysisprovided) and--all-depsnot supplied
PhylumApi.parseLockfileextension API callPython cache
There is also large change to rename internal uses of
lockfileterm.This was done in a separate commit and includes the following basic
changes:
phylum.ci.lockfilemodule tophylum.ci.depfileLockfileclass toDepfile--lockfileargument for thephylum-cicommandTesting
Changes from this PR have been built in Docker images and hosted on Docker Hub for my account, as the
cache_current_parsingtag.Testing was completed with the private
isildurs_banerepo, where it saved ~40s (2m40s --> 2m).It was also completed with the public deepcausality-rs/deep_causality repo, where it saved ~3s (23s --> 20s).