Skip to content

perf(cli/install): bounded pool for collectFormulaJobs#141

Merged
indaco merged 1 commit intomainfrom
perf/install-collect-jobs-pool
Apr 22, 2026
Merged

perf(cli/install): bounded pool for collectFormulaJobs#141
indaco merged 1 commit intomainfrom
perf/install-collect-jobs-pool

Conversation

@indaco
Copy link
Copy Markdown
Owner

@indaco indaco commented Apr 22, 2026

Description

Install's dep-formula fetch phase spawned one thread per dependency and then queued them against a 4-slot HTTP client pool - extra threads just sat idle waiting for a client. On heavy graphs (40+ deps) that's 20+ wasted stacks and a lot of pool contention; on small graphs like ffmpeg (11 deps) the behaviour is unchanged.

Replace it with the same bounded atomic-index pool pattern materializePoolWorker already uses: a fixed set of workers share one fetchAdd index and drain the dep array. Workers never outnumber HTTP client slots, so none of them stall on pool.acquire.

Related Issue

  • None

Notes for Reviewers

  • Worker cap lives in a named constant (MAX_COLLECT_FETCH_WORKERS = 4) so the value and its rationale are co-located.

Replace one-thread-per-dep in the dep-fetch phase with a bounded pool
sharing the atomic-index primitive materializePoolWorker already uses.
Heavy dep graphs no longer over-allocate thread stacks that then block
on the 4-slot HTTP client pool; ffmpeg-sized graphs behave identically.

Generated with Claude Code
@indaco indaco merged commit df870f8 into main Apr 22, 2026
3 checks passed
@indaco indaco deleted the perf/install-collect-jobs-pool branch April 22, 2026 14:00
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