Skip to content

perf: import already-loaded modules statically - #327

Merged
LadyBluenotes merged 3 commits into
mainfrom
perf/static-imports-already-loaded
Oct 4, 2026
Merged

LadyBluenotes merged 3 commits into
mainfrom
perf/static-imports-already-loaded

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

  • Three dynamic imports in validate and one in the target resolution for stale asked for modules (yaml, shared/utils, setup/workspace-patterns) that the same files already load through static imports, so they deferred nothing.
  • Each one made the bundler emit a small facade chunk that Node loaded as an extra file, and import('yaml') requested the whole yaml namespace, which kept every yaml export in the bundle.
  • These modules are now imported statically.
  • The built package goes from 744,550 to 728,853 bytes (15,697 fewer; 4,441 fewer gzipped) and from 63 files to 60.
  • A cold intent list --json --no-notices process, the call the session hook makes, is about 1.5 ms faster (57.9 ms to 56.5 ms at the 25th percentile of 30 runs), because it loads fewer files and 15 kB less code. The warm benchmarks are unchanged, except validate, which is 2.6% faster.
  • Command output and exit codes do not change.
  • Adds a patch changeset.

✅ 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).

Summary by CodeRabbit

  • Improvements
    • Reduced the installed package size by 16 kB.
    • The intent validate and intent stale commands load fewer files, with no change to their behavior.

@changeset-bot

changeset-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 36cba8d

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 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: e0f99f33-49f1-420e-a577-6cd7591d9b31
📥 Commits

Reviewing files that changed from the base of the PR and between cd5a024 and 36cba8d.

📒 Files selected for processing (3)
  • .changeset/static-imports-already-loaded.md
  • packages/intent/src/commands/support.ts
  • packages/intent/src/commands/validate.ts
 ______________________________________________________
< Plot twist: Your tests were the real bugs all along. >
 ------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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 4, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 36cba8d

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

☁️ Nx Cloud last updated this comment at 2026-10-04 22:56:20 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 36cba8d

@LadyBluenotes
LadyBluenotes merged commit a7c93e0 into main Oct 4, 2026
8 of 9 checks passed
@LadyBluenotes
LadyBluenotes deleted the perf/static-imports-already-loaded branch October 4, 2026 22:58
@github-actions github-actions Bot mentioned this pull request Oct 4, 2026
@codspeed

codspeed Bot commented Oct 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing perf/static-imports-already-loaded (36cba8d) with main (cd5a024)

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