deno/cli/npm
Nathan Whitaker 4f7117a081
perf(npm): don't try to cache npm packages we've already cached (#28938)
With `nodeModulesDir: auto` (and `none`, to a lesser extent), we
frequently repeatedly try to cache npm packages during resolution. On a
(private) fresh project, I counted that `sync_resolution_with_fs` was
called 478 times over the course of a fresh build. This reduces the
number of calls to 8, and doing so speeds things up substantially.

```
❯ hyperfine --warmup 2 -N "deno task build" "../deno/target/release-lite/deno task build"
Benchmark 1: deno task build
  Time (mean ± σ):      3.652 s ±  0.042 s    [User: 3.285 s, System: 2.399 s]
  Range (min … max):    3.587 s …  3.712 s    10 runs

Benchmark 2: ../deno/target/release-lite/deno task build
  Time (mean ± σ):      1.356 s ±  0.007 s    [User: 1.961 s, System: 1.108 s]
  Range (min … max):    1.345 s …  1.372 s    10 runs

Summary
  ../deno/target/release-lite/deno task build ran
    2.69 ± 0.03 times faster than deno task build
```
2025-04-17 21:10:51 +00:00
..
installer perf(npm): don't try to cache npm packages we've already cached (#28938) 2025-04-17 21:10:51 +00:00
managed.rs feat(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
mod.rs fix(lockfile): omit tarball url from lockfile if it's the default (#28842) 2025-04-10 14:45:46 -07:00