Uh oh!
There was an error while loading. Please reload this page.
perf(coverage): compute every file's line stats in one awk invocation - #1089
Merged
Conversation
precompute_file_stats called compute_file_coverage once per tracked file, and each call read the whole file into a Bash array and classified it line by line, then took two more subshells to derive the percentage and the class. Three forks and a per-line loop per file: 2585ms for 128 files, the last per-line Bash loop in the report phase. One awk invocation now walks a manifest of hits-block and source pairs with getline, so the fork is paid once for the run: 153ms, and a --coverage run over src goes from 6.81s to 3.77s. Percentage and class fill return slots instead of forking, which the single-file path gets too. The per-file path stays and is used whenever the batch pass cannot run or produces nothing for a non-empty tracked list, so a report is never silently empty. LCOV and the text report are byte-identical on a fixed corpus. Closes#1088
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 freeto 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 #1088
precompute_file_statscalledcompute_file_coverageonce per tracked file,reading each file into a Bash array and classifying it line by line, plus two
more subshells per file to derive the percentage and the class — the last
per-line Bash loop left in the report phase.
💡 Changes
getline, so the fork is paid once per run instead of three times per file--coveragerun oversrc6.81 s → 3.77 s (9.23 s before perf(coverage): scan function declarations in one awk pass #1085). LCOV and the text report are byte-identical on a fixed corpus