Skip to content

perf: skip redundant filesystem probes during discovery and load path rewriting - #344

Merged
LadyBluenotes merged 1 commit into
mainfrom
perf/discovery-fs-probes
Oct 19, 2026
Merged

LadyBluenotes merged 1 commit into
mainfrom
perf/discovery-fs-probes

Conversation

@LadyBluenotes

Copy link
Copy Markdown
Member

🎯 Changes

  • In rewriteSkillLoadPaths, skip existsSync(join(projectRoot, 'node_modules', packageName)) when packageRoot is already that top-level node_modules/<package> directory.
  • In createPackageKindResolver, return () => 'npm' immediately when workspacePackageKeys.size === 0 instead of calling getFsIdentity(packageRoot) on every package.
  • In tryRegister, check raw-path deduplication (attemptedRawDirs) and opts.exists(join(dirPath, 'skills')) before shouldAttemptPackageRoot(dirPath) so lstatSync and realpathSync are not run on node_modules packages that do not ship a skills/ directory.
  • Command output, symlink deduplication, and exit codes do not change.
Benchmark (benchmarks/intent, Vitest 4.1.11 on Windows Node) main (cb45f14) mean (rme) PR (f6b436e) mean (rme) Change
list.bench.ts (scans a consumer workspace) 65.23 ms (±4.86%) 52.92 ms (±1.38%) -18.9% (1.23x)
load.bench.ts (loads a direct dependency skill) 19.30 ms (±1.32%) 17.23 ms (±1.04%) -10.7% (1.12x)

✅ 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: f6b436e

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: c8f3b77b-7d63-41fd-a794-feeb097504a1
📥 Commits

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

📒 Files selected for processing: 5
  • .changeset/cut-discovery-fs-probes.md
  • packages/intent/src/discovery/register.ts
  • packages/intent/src/discovery/scanner.ts
  • packages/intent/src/skills/paths.ts
  • packages/intent/tests/repeated-work.test.ts
+--------------------------------------------------------------------------------------------+
| It is easier to change the specification to fit the program than vice versa. - Alan Perlis |
+--------------------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ 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 f6b436e

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

☁️ Nx Cloud last updated this comment at 2026-10-19 01:19:35 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@344

commit: f6b436e

@LadyBluenotes
LadyBluenotes merged commit 597771f into main Oct 19, 2026
8 of 9 checks passed
@LadyBluenotes
LadyBluenotes deleted the perf/discovery-fs-probes 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

⚠️ 7 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/discovery-fs-probes (f6b436e) 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