-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**What's the problem this PR addresses?** <!-- Describe the rationale of your PR. --> <!-- Link all issues that it closes. (Closes/Resolves #xxxx.) --> Resolving package metadata is slower than it has to be because, most times, Yarn has already fetched it in the past, and some things can be cached and reused. This should improve performance in various cases (ranging from creating new projects and cache-only-but-no-lockfile installs to `yarn up` when no new versions are available), since the server can avoid resending the response body if nothing has changed. **How did you fix it?** <!-- A detailed description of your implementation. --> This PR makes Yarn cache npm package metadata inside `<globalFolder>/npmMetadata/<cacheKey>/<registry>/<package>.json` when `getPackageMetadata` is used. If an exact version is requested, Yarn will return the metadata from disk directly and avoid hitting the network altogether. Otherwise, Yarn will set the `If-None-Match` & `If-Modified-Since` headers using the `etag` & `last-modified` values that were cached during previous requests. This tells the server to skip sending the response body and just respond with `304`, making Yarn reuse the cached metadata. TODO: - [x] Trim the cached metadata of unnecessary fields to decrease cache size - [x] Update benchmark scripts to make sure that they take the metadata cache into account - [x] Run more benchmarks - [ ] Make `yarn cache clean` clean the npm metadata cache (different PR) **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [X] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [X] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [X] I will check that all automated PR checks pass before the PR gets reviewed. --------- Co-authored-by: Maël Nison <nison.mael@gmail.com>
- Loading branch information
1 parent
3eedcba
commit 4897712
Showing
13 changed files
with
352 additions
and
84 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
releases: | ||
"@yarnpkg/cli": minor | ||
"@yarnpkg/core": minor | ||
"@yarnpkg/fslib": minor | ||
"@yarnpkg/plugin-npm": minor | ||
|
||
declined: | ||
- "@yarnpkg/plugin-compat" | ||
- "@yarnpkg/plugin-constraints" | ||
- "@yarnpkg/plugin-dlx" | ||
- "@yarnpkg/plugin-essentials" | ||
- "@yarnpkg/plugin-exec" | ||
- "@yarnpkg/plugin-file" | ||
- "@yarnpkg/plugin-git" | ||
- "@yarnpkg/plugin-github" | ||
- "@yarnpkg/plugin-http" | ||
- "@yarnpkg/plugin-init" | ||
- "@yarnpkg/plugin-interactive-tools" | ||
- "@yarnpkg/plugin-link" | ||
- "@yarnpkg/plugin-nm" | ||
- "@yarnpkg/plugin-npm-cli" | ||
- "@yarnpkg/plugin-pack" | ||
- "@yarnpkg/plugin-patch" | ||
- "@yarnpkg/plugin-pnp" | ||
- "@yarnpkg/plugin-pnpm" | ||
- "@yarnpkg/plugin-stage" | ||
- "@yarnpkg/plugin-typescript" | ||
- "@yarnpkg/plugin-version" | ||
- "@yarnpkg/plugin-workspace-tools" | ||
- vscode-zipfs | ||
- "@yarnpkg/builder" | ||
- "@yarnpkg/doctor" | ||
- "@yarnpkg/extensions" | ||
- "@yarnpkg/libzip" | ||
- "@yarnpkg/nm" | ||
- "@yarnpkg/pnp" | ||
- "@yarnpkg/pnpify" | ||
- "@yarnpkg/sdks" | ||
- "@yarnpkg/shell" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.