Skip to content
Source
Sign inSign up
TanStack/intent

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

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/344/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

🎯 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).
    1. 🦋 Changeset detected

      Latest commit: f6b436e333aff8a06813fdd6e160600afa974e18

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

      This PR includes changesets to release 1 package
      NameType
      @tanstack/intentPatch

      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

    2. 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 9400b3ea5ad5c378f04993fa197cacfe7c1c05ac and f6b436e333aff8a06813fdd6e160600afa974e18.

      📒 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.
    3. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit f6b436e333aff8a06813fdd6e160600afa974e18

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded1m 3sView ↗
      nx run-many --targets=build✅ Succeeded1sView ↗

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

    4. Open in StackBlitz

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

      commit: f6b436e

    5. Merging this PR will not alter performance

      :warning: 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

      :information_source: 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 in to join this conversation.