You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An audit of the coverage feature found two classes of defect: numbers that are wrong, and a report phase that scales badly. This issue tracks the work and fixes the order, because two of the fixes multiply the cost of the others.
All measurements below: Bash 3.2 arm64, macOS, trap engine, running tests/unit/assert/basic_test.sh against --coverage-paths src.
Numbers that are wrong
finding
evidence
issue
files that never ran are absent from the report
11 of 121 src/*.sh files reported, denominator 2,200 against a real 9,285 executable lines
--coverage, nothing tracked (trap fires, early return)
1.63s
--coverage --coverage-paths src, 11 files tracked
6.42s
Split of the 6.42s: 0.39s test work, roughly 1.24s raw trap dispatch, roughly 1.27s report phase, roughly 3.5s capture bookkeeping.
Report phase alone, synthetic hits, every 3rd line:
tracked files
precompute
report_text
report_lcov
default total
11
0.33s
0.03s
0.91s
1.27s
40
1.02s
0.16s
2.66s
3.84s
80
2.19s
0.85s
5.60s
8.64s
121
3.34s
3.12s
9.93s
16.39s
report_text per-file cost grew 6.5x while file count grew 3x. Cause: the stats cache is a string scanned with a leading-* glob, measured at 26.0 ms per lookup at 121 entries. The cache costs more than the computation it replaces.
Order
Performance first, because #1053 raises report input by roughly 11x on this repo. Landing the honest denominator on today's report phase means a 16s report.
Problem
An audit of the coverage feature found two classes of defect: numbers that are wrong, and a report phase that scales badly. This issue tracks the work and fixes the order, because two of the fixes multiply the cost of the others.
All measurements below: Bash 3.2 arm64, macOS, trap engine, running
tests/unit/assert/basic_test.shagainst--coverage-paths src.Numbers that are wrong
src/*.shfiles reported, denominator 2,200 against a real 9,285 executable lines--coverage-diffpasses a new untested fileTotal: 0/0 (100%)and exit 0 under--coverage-min 90src/lines excluded by that rule alone, 236 of them containing$(or=BRDAreports 0 or 1, documented MVP limitCost
--coverage, nothing tracked (trap fires, early return)--coverage --coverage-paths src, 11 files trackedSplit of the 6.42s: 0.39s test work, roughly 1.24s raw trap dispatch, roughly 1.27s report phase, roughly 3.5s capture bookkeeping.
Report phase alone, synthetic hits, every 3rd line:
report_textreport_lcovreport_textper-file cost grew 6.5x while file count grew 3x. Cause: the stats cache is a string scanned with a leading-*glob, measured at 26.0 ms per lookup at 121 entries. The cache costs more than the computation it replaces.Order
Performance first, because #1053 raises report input by roughly 11x on this repo. Landing the honest denominator on today's report phase means a 16s report.
Expect the coverage badge to drop when #1053 lands. That is the point of it.
Notes for whoever picks these up
BASHUNIT_COVERAGE_ENGINE=trapandxtrace. macOS runs 3.2, sotrapis the common case there, andxtraceneeds 4.1+..claude/rules/perf-fork-budget.mdis expressed as "fork count does not grow with source-line count". Keep it that way.