Repository navigation
perf(testing): cut cant-fail-scan's process starts by a third, about 25% off on Windows - #13408
Conversation
The audit suite runs the scanner 643 times, and each run started about 55 processes before reading a file. On Windows Git Bash a start costs 10 to 54 ms, so that fixed cost dominated the suite's wall clock there. - One mktemp -d holds the walk-error log, adapter table, extend list and the parallel engine's records, in place of two to four mktemp calls. - The walk feeding xargs prints NUL-separated and unsorted: its callers sort grep's output, so the sort and tr stages did nothing. - The test-file walk merged with content claims is no longer sorted twice. - git output drops carriage returns by parameter expansion, not tr. - dirname and basename become parameter expansion (dir_of keeps dirname's answer for every path shape), pick_adapter sets a variable instead of printing into a subshell, nproc runs only when a parallel scan can happen, and the error-line count is a read loop instead of awk. Output is byte-identical to the previous scanner over the repository tree, every fixture directory and every corpus file, in report, --count, --check, --check --strict, --blocks and --findings modes, serial and parallel, under gawk and mawk. Refs: #13231 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…test.sh The corpus loop runs once per corpus fixture (326) and started about 13 processes per fixture around the scanner call: three seds for the reads, adapter and expect headers, a grep for exempt, and two sed | sort -u | paste pipelines for the expected and reported rule sets. One tagged sed pass now reads all four headers, and set_of builds both rule sets in bash. The assertions and their labels are unchanged: the extracted values match the old pipelines on all 326 fixtures, and the suite prints the same PASS lines. Refs: #13231 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refs: #13231 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… spawn cut Alternated Windows Git Bash pairs on one host: 1294 and 1421 s before, 993 and 1069 s after; every run passed. Refs: #13231 Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # docs/test-wall-clock-baseline.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: PR #13408 (full review, first head)I found no security issues in this change. I read every hunk of all 4 changed files. None of them matches a trusted-path glob, and none is a trust control, merge hold, plugin manifest or standing instruction. What I checked:
PR context: it contains no embedded instructions aimed at the review lane. Spend: the PR does not change spending. It only makes a local test suite run faster. critical-findings: 0 |
|
claude-review reviewed Code review: no findingsI read every hunk in all 4 changed files: the changelog fragment, What I checked (by reading the code; I ran nothing)
Scratch directory. The parallel engine's files are
Walk-error count. The read loop counts lines that contain something other than a space or tab, including a last line with no newline. That matches awk's
Test harness.
Closing issue #13231, Done when
The claims of byte-identical output and of the process-start counts are the author's own and unverified. No plugin manifest changed. The changelog fragment's |
Post-merge mutation testingKilled 3, survived 4, timeout 0, no coverage 0, invalid 0, not run 0.
Surviving mutants
The run's summary has the full report. |
Closes #13231
Summary
cant-fail-scan.test.shwas the slowest suite on Windows Git Bash. Lane 5's one-walk cut showed no Windows gain (#13231), so this change starts from where the process starts go. A Linuxstrace -fof one engine leg, attributed by nearest parent and weighted by Lane 5's Windows per-launch costs, gave these estimates:sortfindtrxargsmktempThe estimate totals 953 s against about 780 s measured. It runs high because pipeline stages and parallel engine jobs overlap. Lane 5's over-prediction came from the mawk leg: Linux runs the suite twice (gawk, then mawk), and Git Bash has no mawk (
cant-fail-scan.test.sh:2427).Fix
cant-fail-scan.sh):mktemp -dreplaces the separate temp files.xargsuse-print0with nosortortrstage, since their output is sorted afterwards. The test-file walk's double sort is gone.tr -d '\r'is now parameter expansion. Adir_ofhelper matchesdirname, andbasenameis parameter expansion.pick_adaptersets a variable instead of running in a subshell.nprocruns only when the scan can go parallel. The error-line count is a read loop, not awk.cant-fail-scan.test.sh): the corpus loop runs once per fixture (326 of them), one taggedsedpass reads their headers, andset_ofbuilds the rule sets in bash. No assertion changed.docs/test-wall-clock-baseline.md: the suite's row has the new Windows time.Verification
--lines,--brief,--inventory);test-scan.test.shandtest-weaken.test.sheach fail one case locally, the same way on the base clone. That's this host's mise output leaking under a temporary HOME. CI doesn't use mise.Related
🤖 Generated with Claude Code