cleanup(core): cache compiled glob sets to avoid redundant recompilation#34602
Merged
FrozenPandaz merged 1 commit intomasterfrom Feb 25, 2026
Merged
cleanup(core): cache compiled glob sets to avoid redundant recompilation#34602FrozenPandaz merged 1 commit intomasterfrom
FrozenPandaz merged 1 commit intomasterfrom
Conversation
Static DashMap cache keyed on sorted+joined globs eliminates redundant glob compilation in build_glob_set. Profiled on this repo with `nx run-many -t build lint test --parallel 8` (NX_HASH_ONLY=true, N=10 runs): 10,202 total calls, 444 unique patterns, 95.6% hit rate. cpu_user: 8011ms -> 4782ms (-40.3%), wall: 2182ms -> 1898ms (-13.0%).
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
View your CI Pipeline Execution ↗ for commit 9e73481
☁️ Nx Cloud last updated this comment at |
FrozenPandaz
approved these changes
Feb 25, 2026
FrozenPandaz
pushed a commit
that referenced
this pull request
Feb 26, 2026
…ion (#34602) ## Current Behavior `build_glob_set` recompiles identical glob pattern sets on every call, even when the same set of patterns has been compiled before. ## Expected Behavior Compiled `NxGlobSet` instances are cached in a static `DashMap` keyed by sorted glob strings. Repeated calls with the same patterns return a shared `Arc<NxGlobSet>` instead of recompiling. Profiling `nx run-many -t build lint test --parallel 8` in the Nx repo measured 95.6% cache hit rate (9,758 of 10,202 calls) with only 444 unique pattern sets, reducing hashing-phase CPU by ~40%. (cherry picked from commit 12812dc)
FrozenPandaz
pushed a commit
that referenced
this pull request
Feb 26, 2026
…ion (#34602) ## Current Behavior `build_glob_set` recompiles identical glob pattern sets on every call, even when the same set of patterns has been compiled before. ## Expected Behavior Compiled `NxGlobSet` instances are cached in a static `DashMap` keyed by sorted glob strings. Repeated calls with the same patterns return a shared `Arc<NxGlobSet>` instead of recompiling. Profiling `nx run-many -t build lint test --parallel 8` in the Nx repo measured 95.6% cache hit rate (9,758 of 10,202 calls) with only 444 unique pattern sets, reducing hashing-phase CPU by ~40%. (cherry picked from commit 12812dc)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
build_glob_setrecompiles identical glob pattern sets on every call, even when the same set of patterns has been compiled before.Expected Behavior
Compiled
NxGlobSetinstances are cached in a staticDashMapkeyed by sorted glob strings. Repeated calls with the same patterns return a sharedArc<NxGlobSet>instead of recompiling. Profilingnx run-many -t build lint test --parallel 8in the Nx repo measured 95.6% cache hit rate (9,758 of 10,202 calls) with only 444 unique pattern sets, reducing hashing-phase CPU by ~40%.