Description
Version
22.13.1
Platform
Linux codespaces-e55842 6.5.0-1025-azure #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
node/src/node_modules.cc
What steps will reproduce the bug?
Loading multiple files in the same folder (that doesn't contain a package.json) will trigger NodeJS to attempt to read package.json in that folder once for each file, rather than caching that the file did not exist and skipping the syscall.
How often does it reproduce? Is there a required condition?
100% reproduction.
What is the expected behavior? Why is that the expected behavior?
This check:
Lines 106 to 108 in 82ac335
should cache the "missing file" response in the package json result cache, so that future checks for that package.json will return a "missing file" result early and skip the syscall.
What do you see instead?
For each and every file load within a given directory that does not contain a package.json, NodeJS is making a separate open
syscall against the package.json path for that folder.
Additional information
This is a performance regression from Node 18, which cached "missing file" results in its package.json cache.
Metadata
Assignees
Type
Projects
Status
Awaiting Triage