The Wire · Showcase
READFILE 3-6x FASTER: NODE'S SMALL-FILE PATH COLLAPSES FOUR ROUND TRIPS INTO ONE
By RepoJournal · Filed · About Node.js
Node.js just made the most common filesystem call dramatically faster, and a second PR cuts cold require() times for large CommonJS trees.
fs.readFile() and fs.promises.readFile() of small files get 3 to 6x faster by doing open, fstat, read, and close in a single libuv thread pool task instead of four, freeing pool slots for concurrent DNS, fs, and crypto work [1]. The same author also cut cold require() of a 1000-module CommonJS tree by about 6% (and module-require tests up to 13.7%) by caching the nearest parent package.json per directory rather than per file [2]. Meanwhile, Matteo Collina's thirteenth round of pure-JS webstreams optimizations decouples transform backpressure changes; the PR is stacked on #65138, so reviewers should focus only on the last commit [3]. Over in undici, interceptor composition silently dropped onBodySent and onRequestSent callbacks because DecoratorHandler defined one as a no-op and omitted the other; the fix forwards both through RetryHandler, RedirectHandler, and CacheHandler [4]. Undici also now honours maxResponseSize on HTTP/2 clients, fixing a documented option that was validated but never enforced [5]. HTTP/2 timeout tests are stabilized by skipping a churn stress test on Linux Node.js 24 and 25 where an upstream issue can terminate the process prematurely [6]. In related housekeeping, doc-kit adds an opt-in reading time toggle to its documentation pages [7]. Overall: 16 commits and 15 PRs across 4 repos this period, with the fs and module wins being the ones to watch.
One email a day. Unsubscribe in one click.
Keep up with Node.js in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Review PR #65327 (small-file readFile) and PR #65326 (package.json caching) in nodejs/node; benchmark against your workloads, then prepare to land. nodejs/node [plan]
- → If you compose undici interceptors (retry, redirect, cache), track PR #5696 for the onBodySent/onRequestSent fix and test your uploads once it lands. nodejs/undici [plan]
- → Check undici PR #5676 for maxResponseSize enforcement on H2CClient; if you rely on that limit, verify your version now. nodejs/undici [monitor]
- → In nodejs/node PR #65143, review only the last commit (decouple transform backpressure); the first three are from #65138. nodejs/node [immediate]
References
- [1] fs: read small files in one thread pool round trip ↗ nodejs/node
- [2] module: cache nearest parent package.json per directory ↗ nodejs/node
- [3] stream: decouple transform backpressure changes ↗ nodejs/node
- [4] fix: forward onBodySent/onRequestSent through interceptor handlers ↗ nodejs/undici
- [5] fix(h2): honour maxResponseSize ↗ nodejs/undici
- [6] test: stabilize HTTP/2 timeout tests ↗ nodejs/undici
- [7] chore: opt-in reading time ↗ nodejs/doc-kit