Skip to content

perf(ci): JS toolchain bootstrap costs ~143s on cold cache and re-pays it per worktree #3968

Closed

Description

@zackees

Summary

The JS lint toolchain bootstrap (ci/setup-js-linting-fast.py) costs ~143s on a cold cache and re-pays that cost per-repo and per-worktree. This tracks the local fixes plus adoption of the global tool cache proposed in forge-ci/zccache#1469.

Measured breakdown

Warm steady-state JS linting is ~12s (ESLint 3.4s + tsc --noEmit 3.0s + overhead) — the linter itself is not the problem. The 143s is one-time setup:

Stage Measured
Node.js download (29.7 MB, single stream @ 2.1 MB/s) 14.2s
Zip extraction (2,134 files, Python zipfile) 3.1s
npm install (134 pkgs, cold cache) 13.5s
Actual lint 11.8s
Accounted ~42s
Unexplained ~100s

The residual is most plausibly Windows Defender real-time scanning of the 5,483 newly-written files (85 MB Node + 47 MB node_modules), compounded by contention — that stage ran concurrently with three other lint stages. This is inference and has not been isolated.

Proposed work

1. Stop deleting the downloaded archive (small, immediate)

ci/setup-js-linting-fast.py:141 does download_path.unlink() after extracting. Any re-setup therefore re-downloads 29.7 MB. Retaining the archive makes re-setup nearly free.

2. Confirm and document the Defender cost (largest unknown)

Measure setup with .cache/ excluded from Windows Defender. If this accounts for the unexplained ~100s, document the exclusion as recommended developer setup. This is the single highest-value item and requires no code change.

3. Adopt zccache fetch once available (strategic)

Depends on forge-ci/zccache#1469. Replaces the bespoke httpx download + extract path in setup-js-linting-fast.py with a global content-addressed fetch, giving:

  • Segmented download — measured 3.7x on this exact payload (14.2s → 3.9s with 8 connections, byte-identical). nodejs.org advertises Accept-Ranges: bytes.
  • Conditional-GET revalidation — measured 304 in 0.14s / 0 bytes vs 200 in 16.0s / 29.7 MB.
  • Cross-repo and cross-worktree reuse — the toolchain stops being downloaded once per checkout.
  • Integrity — the current path has no checksum verification; transport is the only guarantee.

Non-goals

Do not swap ESLint for Bun. Investigated and rejected on two independent grounds:

oxlint is viable but low-value. .cache/js-tools/.eslintrc.cjs already sets project: null (type-aware linting disabled), so every rule in use is syntactic and oxlint would be a near drop-in. But footprint is dominated by the Node runtime (85 MB) and typescript (23 MB), both of which stay because tsc does the type checking and needs Node. Net: 132 MB → ~108 MB, and ~3.3s off a 12s run. Cleanup, not a lever.

Scope caveat

All of the above optimizes a one-time cache miss. The recurring cost is the stop hook at ~7 minutes, dominated by uv run test.py --cpp. Two separate issues worth filing:

  • ci/hooks/check-on-stop.py should_skip_hook() fingerprints git status --porcelain, so any untracked file makes the hook run the full C++ suite on every stop.
  • The hook's working-directory resolution uses cd "$(git rev-parse --show-superproject-working-tree || git rev-parse --show-toplevel || echo .)". --show-superproject-working-tree exits 0 with empty output outside a submodule, so || never advances to the fallback, cd "" is a silent no-op, and the hook resolves ci/hooks/ against whatever cwd it inherited. It only works when cwd is already the repo root; any drift wedges every tool call.

Activity

  1. zackees commented on Aug 22, 2026

    @zackees
    MemberAuthor

    Tracked in the meta issue: #3986 — remote assets: hosting, build-time resolution, and on-device filesystem deployment.

  2. moved this from Triage to Done in FastLED Trackeron Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions