Skip to content

perf(ci): run infra jest across all runner cores - #1112

Closed
DerrickF wants to merge 1 commit into
developfrom
perf/infra-jest-workers
Closed

DerrickF wants to merge 1 commit into
developfrom
perf/infra-jest-workers

Conversation

@DerrickF

Copy link
Copy Markdown
Contributor

What

Bumps the infrastructure jest job from --maxWorkers=2 to --maxWorkers=100%. With the backend suite parallelized in #1111, the infra job became the PR long pole (~6m30s). The old cap left half the runner's cores idle — jest's own default on a 4-vCPU box is 3 workers, so 2 was below default.

Why it's safe

  • ts-jest + CDK template synthesis is CPU-bound and each test file is independent → parallelizes cleanly.
  • ubuntu-24.04 = 4 vCPU / 16 GB, so 4 workers get ~4 GB each — ample for CDK synth.
  • One-line workflow flag, fully reversible.

Measurement

Baseline infra job: ~6m32s (--maxWorkers=2). Target: this PR's own Test infrastructure (jest) run — comparing the two is the proof.

Follows #1111 (backend pytest xdist: ~572s → 318s).

Bump the infrastructure jest job from --maxWorkers=2 to --maxWorkers=100%. On the 4-vCPU ubuntu-24.04 runner the old cap left half the cores idle (jest's own default there is 3 workers). With the backend suite now parallel (#1111), the infra job is the PR long pole at ~6m30s; ts-jest + CDK synth is CPU-bound so it parallelizes well. 16 GB RAM comfortably fits 4 workers.
@DerrickF

Copy link
Copy Markdown
Contributor Author

Closing: measured regression — infra jest went 392s (--maxWorkers=2) to 977s (--maxWorkers=100%), 2.5x slower. ts-jest re-runs type-checking per worker with no shared cache and CDK synth is memory-heavy, so extra workers thrash. Correct fix is a cheaper per-worker transform (transpile-only) plus a single shared tsc gate, not more workers.

@DerrickF DerrickF closed this Sep 15, 2026
DerrickF added a commit that referenced this pull request Sep 15, 2026
Make ts-jest transpile-only (isolatedModules) so jest workers stop re-type-checking the whole project each — the dominant cost of the infra suite (the long pole once backend went parallel in #1111). Add a single 'tsc --noEmit' (npm run build) step to the infra CI job so type safety is preserved on PRs (previously only ts-jest enforced it; tsc ran only in teardown.yml). Workers stay at 2 (the --maxWorkers bump regressed 2.5x in #1112). No const enum in the tree, so isolatedModules is safe. Verified: tsc clean; 178 tests green transpile-only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant