Skip to content

perf(fmt): bound concurrent formatting tasks - #640

Merged
chenjiahan merged 3 commits into
mainfrom
chenjiahan/perf-fmt-bounded-scheduling
Nov 15, 2026
Merged

chenjiahan merged 3 commits into
mainfrom
chenjiahan/perf-fmt-bounded-scheduling

Conversation

@chenjiahan

@chenjiahan chenjiahan commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Motivation

Submitting every file at once creates unnecessary task and promise overhead in large repositories.

Changes

Bound in-flight formatting tasks to the worker count, following prettier/prettier-cli#115. Filter cached unsupported files before scheduling and process a single remaining file directly. Preserve Markdown priority, result order, caching, and error handling.

Performance

Median of six interleaved runs of rs fmt --check --parallel-workers 8, comparing e34541f with this change on an Apple M5 Max, Node.js 24.19.0. Node compile caching was disabled; “empty cache” refers to the formatter cache, not the OS cache.

Workload Time before → after Peak RSS before → after
100 source/docs files, cache disabled 235 → 234 ms (0%) 543 → 532 MiB (−2%)
100 source/docs files, cache hits 66 → 66 ms (0%) 160 → 160 MiB (0%)
20,000 small JSON files, cache disabled 1046 → 1034 ms (−1%) 1130 → 1126 MiB (0%)
20,000 small JSON files, empty cache 1088 → 1074 ms (−1%) 1149 → 1136 MiB (−1%)
20,000 small JSON files, cache hits 452 → 418 ms (−8%) 257 → 238 MiB (−7%)
20,000 cached unsupported files + 1 JSON file 102 → 96 ms (−5%) 98 → 91 MiB (−6%)

The large workloads are synthetic. Small-workload results are effectively unchanged, and RSS varies during formatting; gains are clearest with large cache-hit workloads. Percentages are calculated before rounding.

Validation

Build, native build, pnpm check, and tests passed (448 passed, 1 skipped).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T01:52:03.605931Z 827fef8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Deploying rstack-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 827fef8
Status: ✅  Deploy successful!
Preview URL: https://f1af9280.rstack-cli.pages.dev
Branch Preview URL: https://chenjiahan-perf-fmt-bounded.rstack-cli.pages.dev

View logs

@chenjiahan
chenjiahan merged commit ba3e6b7 into main Nov 15, 2026
5 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/perf-fmt-bounded-scheduling branch November 15, 2026 01:58
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