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
perf(runner): unset each file's test functions after processing
Test files are sourced into the main shell and their functions stayed
defined for the whole run. Every test executes in a $() subshell, so
each fork copied an ever-growing shell and multi-file runs slowed down
quadratically: bashunit's own unit suite spent ~2s/file on its last
files vs 0.3s/file on its first (the last 18 files take 8.7s standalone
but ~38s as the tail of the full run).
Unset a file's test functions (full pre-tag/rerun list) next to the
existing hook cleanup. In parallel mode the file's workers have already
forked with their own copy by the time the parent unsets, so it is
race-free. unset -f is a builtin: no new forks, Bash 3.0-safe.
Unit suite: ~64s -> ~21.5s sequential, ~26s -> ~7s parallel.
Full suite: ~2m48s -> ~2m07s sequential, ~55s -> ~24.5s parallel.
Closes#829
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
-`--jobs auto` / `-j auto` caps parallel concurrency at the CPU core count (portable across Linux/macOS/BSD); the default stays unlimited (#766)
17
17
18
18
### Changed
19
+
- Multi-file runs are no longer quadratic in file count: each file's test functions are unset once the file has been processed, so test subshells stop forking an ever-growing shell. bashunit's own 63-file unit suite: ~64s -> ~22s sequential, ~26s -> ~7s parallel (#829)
19
20
- Major performance work with no behaviour change: assertions, per-test execution, per-file discovery, cold start and parallel result publishing are now (near) fork-free, snapshots and `--tag` scans are cached, and quadratic failure rendering is single-pass. Benchmarks on bash 3.2: 100x10 `assert_equals`~1.50s -> ~0.76s, 500 snapshot assertions ~7.5s -> ~3.0s, 100 tagged tests ~2.92s -> ~0.68s, and bashunit's own acceptance suite ~61s -> ~17s (#761-#764, #772-#775, #798, #801-#807, #809, #810, #813, #817)
20
21
- Per-test timing now defaults to `auto` (`BASHUNIT_SHOW_EXECUTION_TIME=true|false|auto`): shown only when the clock is fork-free, avoiding `perl` forks on bash 3.2; `--profile`/`--verbose`/reports still measure (see `adrs/adr-008-auto-skip-per-test-timing.md`) (#765)
21
22
-`assert_equals`/`assert_same` failures with multiline values now render a git word-diff below the header (requires git, opt out with `BASHUNIT_NO_DIFF=true`, respects `--no-color`); machine reports keep the raw values (#777)
0 commit comments