Repository navigation
perf(coverage): read the tracking decision cache once per process - #1109
Merged
Merged
Conversation
should_track keeps its decisions in a file and consulted it with
cached_decision=$(grep "^${file}:" "$cache_file" | head -1)
three processes per lookup. The in-memory caches die with each test subshell,
so that ran 1427 times in a single run of one test file, over 13 distinct
files: 2ms per lookup against 0.064ms for an in-memory scan of the same
entries. The same shape #1076 removed from the stats cache -- a cache costing
more than the computation it replaces.
The file is read once per process now and entries this process writes are
appended to both copies, so it is never re-read. A worker that misses an entry
another worker appended afterwards recomputes it, which is the same decision
at a little cost.
4.4s to 3.3s for --coverage over src on one test file, same hit count,
sequential and parallel agreeing. The dirname fork in the parallel cache path
goes too: it ran per call.
Closes #1104
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.
🤔 Background
Related #1104
should_trackconsulted its on-disk decision cache with$(grep "^${file}:" "$cache_file" | head -1)— three processes per lookup. Thein-memory caches die with each test subshell, so that ran 1427 times in one
run of one test file, over 13 distinct files.
💡 Changes
--coveragerun of one test file 4.4 s → 3.3 s, same hit count, sequential and parallel agreeingdirnamefork in the parallel cache path goes too — it ran per call