Skip to content

perf(runner): drop 6 mktemp forks per cold start (#798)#801

Merged
Chemaclass merged 1 commit into
mainfrom
feat/798-reduce-coldstart-mktemp-forks
Jul 15, 2026
Merged

perf(runner): drop 6 mktemp forks per cold start (#798)#801
Chemaclass merged 1 commit into
mainfrom
feat/798-reduce-coldstart-mktemp-forks

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #798

Profiling the acceptance suite (~258 nested bashunit runs) showed cold-start fork overhead, not per-test cost, dominating wall-clock. Each cold start forked mktemp six times to create deferred-output scratch files.

💡 Changes

  • Derive the six scratch files (failures/skipped/incomplete/risky/profile/rerun) from one run-unique directory instead of a mktemp fork each — random_str is fork-free and consumers create the files lazily via >>.
  • Result: 6 → 0 mktemp forks per cold start; ~62ms → ~50ms per nested run on bash 3.2 (~3s off the acceptance suite).
  • Added a fork-census regression test (skipped on Windows where process tracing is unreliable).

The deferred-output scratch files (failures, skipped, incomplete, risky,
profile, rerun) each forked mktemp at cold start. Across the acceptance
suite's ~258 nested bashunit runs that is ~1.5k forks and a large share of
cold-start cost. Derive them from a single run-unique directory instead:
random_str is fork-free and consumers create the files lazily via >> or
guard reads with [ -s ], so pre-creation is unnecessary.

6 -> 0 mktemp forks per cold start; ~62ms -> ~50ms per nested run on bash 3.2.

Closes #798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant