Skip to content

perf: split jsonc-parser edit and format out of project-context - #343

Merged
LadyBluenotes merged 1 commit into
mainfrom
perf/jsonc-parser-split
Oct 19, 2026
Merged

LadyBluenotes merged 1 commit into
mainfrom
perf/jsonc-parser-split

Conversation

@LadyBluenotes

Copy link
Copy Markdown
Member

🎯 Changes

  • workspace-patterns.ts imported parse from 'jsonc-parser', which tsdown.config.ts aliased to jsonc-parser/lib/esm/main.js. Because main.js also imports ./impl/edit and ./impl/format (used by install and maintainer), Rolldown bundled the entire jsonc-parser module graph (scanner.js, string-intern.js, format.js, parser.js, edit.js, main.js) into the shared dist/project-context-*.mjs chunk, which is loaded on startup by intent list, intent load, intent stale, and intent validate.
  • Point workspace-patterns.ts's jsonc-parser/lib/esm/main.js import at jsonc-parser/lib/esm/impl/parser.js in tsdown.config.ts, so edit.js, format.js, string-intern.js (which eagerly allocates 1,220 whitespace strings at module evaluation time), and main.js move into a separate chunk (dist/main-*.mjs) loaded only by install and maintainer.
  • dist/project-context-*.mjs shrinks from 54.14 kB raw (11.82 kB gzip) to 34.21 kB raw (7.83 kB gzip) — -19.93 kB raw (-3.99 kB gzip) on every read-only CLI command.
  • Command output, Deno workspace parsing, and exit codes do not change.
Metric (tsdown v0.22.14 / rolldown v1.2.12) main (cb45f14) PR (9a61b1e) Change
dist/project-context-*.mjs (raw) 54.14 kB (54,141 B) 34.21 kB (34,213 B) -19.93 kB (-36.8%)
dist/project-context-*.mjs (gzip) 11.82 kB 7.83 kB -3.99 kB (-33.8%)

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr (run pnpm build:all first).

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9a61b1e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tanstack/intent Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 58396e9c-cfe3-469a-8b4e-126a6a2ca918
📥 Commits

Reviewing files that changed from the base of the PR and between 9400b3e and 9a61b1e.

📒 Files selected for processing: 3
  • .changeset/split-jsonc-parser-edit.md
  • packages/intent/src/setup/workspace-patterns.ts
  • packages/intent/tsdown.config.ts
+------------------------------------------------------------+
| To infinity and beyond! Scouring your code for pesky bugs. |
+------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 9a61b1e

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 1m 2s View ↗
nx run-many --targets=build ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-10-19 01:19:29 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@tanstack/intent@343

commit: 9a61b1e

@LadyBluenotes
LadyBluenotes merged commit 8b2e645 into main Oct 19, 2026
8 of 9 checks passed
@LadyBluenotes
LadyBluenotes deleted the perf/jsonc-parser-split branch October 19, 2026 01:18
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
@codspeed

codspeed Bot commented Oct 19, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 7 benchmarks have no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

✅ 12 untouched benchmarks


Comparing perf/jsonc-parser-split (9a61b1e) with main (9400b3e)

Open in CodSpeed

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