Uh oh!
There was an error while loading. Please reload this page.
perf(coverage): scan function declarations in one awk pass - #1085
Merged
Conversation
extract_functions walked each file in Bash and counted braces with two pattern substitutions per line: 17.5ms per file against a 3.5ms fork floor, paid once per file per renderer. The same state machine in awk is 2238ms to 399ms over 128 files, and report_lcov 5052ms to 2638ms. The rules are unchanged, quirks included, and the output was diffed against the Bash implementation over all 463 shell files in the repo. The characterization tests pin the spans that carry the risk: nested braces, single-line bodies, every declaration spelling, an unclosed body at EOF and the shapes that are not declarations. Closes#1084
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 13, 2026
Closed
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 #1084
extract_functionswalked each source file in Bash, counting braces with twopattern substitutions per line — 17.5 ms per file against a 3.5 ms fork floor,
and the report phase pays it once per file per renderer.
💡 Changes
extract_functions2238 ms → 399 ms over 128 files,report_lcov5052 ms → 2638 ms, and a--coveragerun oversrc9.23 s → 6.81 s