Uh oh!
There was an error while loading. Please reload this page.
perf(coverage): escape the HTML report once per file, not twice per line - #1097
Merged
Conversation
An HTML report over this repo took 58.7s for 128 files. Almost all of it was
one line: every source line was escaped through a command substitution AND a
sed, about 22,000 processes for ~11,000 lines. It is 9.5s now, byte-identical
output over a fixed corpus.
The escaping stays out of Bash on purpose. Bash 5.2 made a bare & in a
substitution REPLACEMENT mean the matched text, so ${line//</<} yields
<lt; there, while spelling it \& for 5.2 emits a literal backslash on 3.2 --
verified on 3.2, 4.4 and 5.3. Both failures are silent, so a whole file goes
through one awk pass instead.
The per-page wc -l | tr -d, the three basename calls and the pwd become
parameter expansions, and the per-function percentage joins the class #1092
already converted -- that PR left one of the two forks behind.
A fork census pins the property that was fixed: sed count does not grow with
source-line count. Reverting the emitter fails it.
Closes#1096
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 #1096
An HTML report over this repo's
srctook 58.7 s for 128 files. Almost allof it was one line: every source line was escaped through a command
substitution and a
sed— roughly 22,000 processes for ~11,000 lines.💡 Changes
&in a substitution replacement mean the matched text, so${line//</<}yields<lt;there, while spelling it\&for 5.2 emits a literal backslash on 3.2 — verified on 3.2, 4.4 and 5.3, and both failures are silentwc -l | tr -d, threebasenamecalls and apwdbecome parameter expansions; the per-function percentage joins the class perf(coverage): the text report forks a subshell per file just to pick a colour #1092 converted, which had left one of the two forks behindsedcount does not grow with source-line count — and reverting the emitter fails it