Skip to content

perf: largest-first worker scheduling to trim the mega-file tail (one file is 10-14% of wall) #3175

Closed

Description

@squid-protocol

From the 2026-09-18 profiling: single files dominate the worker tail on both repos — deps/v8/src/codegen/code-stub-assembler.cc is 14.2s of node's 138s wall (~10%) and extensions/terminal-suggest/src/completions/git.ts is 8.3s of vscode's 57.5s (~14%). If such a file is dequeued late, the whole scan waits on one worker while the rest idle. Submitting files to the pool largest-first (classic LPT scheduling) bounds that tail at zero regex risk.

Task

Sort the file list handed to the worker pool by descending size (or better, by the aperture-known LOC) before dispatch. Do NOT let the ordering change reach any output: results must be collected and ingested in the original deterministic order (autoincrement row IDs in master.db/graph.sqlite and any ordered artifact surface must be byte-stable relative to today, modulo the known hash-seed call-list nondeterminism).

Efficient workflow (time/token/model)

  • Measure before building: the win only exists if big files currently land late. A 10-line probe first — log per-file (dequeue timestamp, duration) for one node run and check whether the top-10 slow files finish in the last quartile of the scan. If they already run early, close this issue with that one plot; ~30 min total, fleet-able.
  • If confirmed, the change itself is a one-line sort at the dispatch site plus an ordered-collection guarantee — the review effort goes entirely into the second half. Verification: A/B wall clock (3 alternating rounds, PYTHONPATH engines, GITGALAXY_LICENSE_KEY=COMMUNITY_FREE_TIER, sandbox off) on node + vscode, plus one A-vs-A artifact control diff to separate ordering effects from the pre-existing hash-seed noise (~128 call-list rows on curl). Golden crucible both legs to prove artifact ordering held.
  • Cost split: probe + sort = small model; the ordered-ingest audit (where a subtle bug would silently reorder artifacts) deserves one focused frontier pass.
  • Expected ceiling: a few percent of wall on mega-repo scans; near-zero on repos without a dominant file. Cheap enough to be worth it if the probe confirms.

🤖 Generated with Claude Code

Activity

  1. squid-protocol commented on Sep 18, 2026

    @squid-protocol
    OwnerAuthor

    From the #3173 session:

    The tail files this issue names are vscode/node (git.ts 8.3s = 14% of vscode wall; code-stub-assembler.cc 14.2s = 10% of node wall) — and those source trees are no longer on the box (only prior outputs remain). The largest-first idea is sound, but the tail needs re-measuring on present mega-repos (all_language_repo, curl, temporal-crucible-pool) before scheduling work against it.

    Probe-first tooling is now available: tests/tools/phase_ab.py (#3178) drives the engine with --file-speed --splicing-speed and already parses the per-file tail (the Ns | bars | <path> lines). A largest-first scheduling change can be A/B'd through it directly — wall + phase deltas with an A-vs-A control — so this can start with a cheap "does reordering the worker queue move the wall on a repo with a fat tail" probe before any scheduler surgery.

  2. added 2 commits that reference this issue on Sep 18, 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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions