fix(perf): only initialize workpaces when we are inside a workspace#7360
Merged
wraithgar merged 1 commit intonpm:latestfrom Apr 10, 2024
H4ad:perf/lazy-load-workspaces-base-command
Merged
fix(perf): only initialize workpaces when we are inside a workspace#7360wraithgar merged 1 commit intonpm:latestfrom H4ad:perf/lazy-load-workspaces-base-command
wraithgar merged 1 commit intonpm:latestfrom
H4ad:perf/lazy-load-workspaces-base-command
Conversation
Member
|
Only 14 commands call $ grep -rc setWorkspaces lib/commands/|grep -v "0\$"
lib/commands//exec.js:1
lib/commands//owner.js:1
lib/commands//run-script.js:2
lib/commands//pack.js:1
lib/commands//query.js:1
lib/commands//version.js:3
lib/commands//init.js:1
lib/commands//publish.js:1
lib/commands//unpublish.js:1
lib/commands//dist-tag.js:1
lib/commands//view.js:1
lib/commands//sbom.js:1
lib/commands//pkg.js:1
lib/commands//diff.js:1 |
wraithgar
approved these changes
Apr 10, 2024
wraithgar
pushed a commit
to npm/package-json
that referenced
this pull request
Apr 10, 2024
Since npm run didn't call those steps, we can save some `ms` by lazy loading this dependency. Before:  After:  The entire load time didn't change, still `13ms` before & after, but if we call `npm run` inside a project that didn't have workspaces, we will save some `ms`, like this one:  But this will also require the PR npm/cli#7360 to be merged.
Merged
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If we didn't load
glob, we can save up to6msby lazy loading this module.