Skip to content
Latchkey

How to Batch Small CI Jobs to Cut Startup Overhead

Ten tiny jobs each pay the same checkout and setup cost; one batched job pays it once.

Every job re-checks-out the repo and re-installs tooling before doing seconds of real work. When many jobs are that small, the fixed setup overhead dominates. Batching related work into fewer jobs amortizes it.

Steps

  • Find jobs whose real work is short relative to their setup.
  • Merge related short jobs into one job with sequential steps.
  • Keep genuinely parallel, long jobs separate so total wall time does not grow.

Workflow

.github/workflows/ci.yml
jobs:
  checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run lint
      - run: npm run typecheck
      - run: npm run test:unit

Tradeoffs

  • Batching serializes work, so it can add wall-clock time versus parallel jobs.
  • Batch only where setup dominates; keep long independent jobs parallel.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →