Skip to content

perf(install): request abbreviated packuments from npm registry#32364

Merged
nathanwhit merged 3 commits intodenoland:mainfrom
nathanwhit:npm-abbreviated-metadata
Mar 2, 2026
Merged

perf(install): request abbreviated packuments from npm registry#32364
nathanwhit merged 3 commits intodenoland:mainfrom
nathanwhit:npm-abbreviated-metadata

Conversation

@nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented Feb 27, 2026

Here's the speedup with a clean cache against an astro starter repo

Benchmark 1: ~/Documents/Code/deno/target/release-lite/deno install
  Time (mean ± σ):      6.535 s ±  0.578 s    [User: 1.417 s, System: 7.037 s]
  Range (min … max):    5.783 s …  7.443 s    10 runs

Benchmark 2: ~/Documents/Code/deno/target/deno-baseline install
  Time (mean ± σ):      8.555 s ±  1.429 s    [User: 2.159 s, System: 6.828 s]
  Range (min … max):    6.736 s … 11.942 s    10 runs

Any package that has a large packument should see a noticeable speedup, since the abbreviated versions tend to be 2-5x smaller.

One complication is that the time field is not present in abbreviated metadata, so if you are using the minimum-dependency-age resolution option, then we have to request the full metadata. Then that full metadata gets written to the fs cache. So basically if you're using minimum-dependency-age you won't see a benefit, which is unfortunate but no good way around it at this point.

Disclosure: the idea and direction came from me, claude did the code changes, but i've reviewed every line in the PR

Request the abbreviated install manifest format (application/vnd.npm.install-v1+json)
which is 2-5x smaller than the full packument. Add has_install_script field to
NpmPackageVersionInfo to support the hasInstallScript field from the abbreviated
format.
@nathanwhit nathanwhit requested a review from dsherret February 27, 2026 23:10
@nathanwhit nathanwhit changed the title feat(npm): request compact packuments from npm registry feat(install): request abbreviated packuments from npm registry Feb 27, 2026
@nathanwhit nathanwhit changed the title feat(install): request abbreviated packuments from npm registry perf(install): request abbreviated packuments from npm registry Feb 27, 2026
@bartlomieju
Copy link
Member

Closes #16177?

@nathanwhit nathanwhit force-pushed the npm-abbreviated-metadata branch from 4ec3a0b to 1849eed Compare March 2, 2026 09:27
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dsherret
Copy link
Member

dsherret commented Mar 2, 2026

Closes #16177?

Might still be useful to slim down the larger cache, but probably not worth the complexity or time it takes to do so.

@nathanwhit nathanwhit enabled auto-merge (squash) March 2, 2026 10:53
@nathanwhit nathanwhit merged commit b9f6889 into denoland:main Mar 2, 2026
220 of 222 checks passed
@nathanwhit nathanwhit deleted the npm-abbreviated-metadata branch March 2, 2026 11:29
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.

3 participants