Uh oh!
There was an error while loading. Please reload this page.
fs: improve performance of recursive directory read - #65524
Conversation
nodejs-github-bot
commented
Aug 24, 2026
Review requested:
|
avivkeller
commented
Aug 24, 2026
cc @nodejs/fs |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@## main #65524 +/- ##
==========================================
- Coverage 90.06% 90.02% -0.05%
==========================================
Files 751 754 +3 Lines 254919 256705 +1786 Branches 48124 48552 +428 ==========================================
+ Hits 229603 231099 +1496 - Misses 16492 16701 +209 - Partials 8824 8905 +81
🚀 New features to boost your workflow:
|
codebytere
left a comment
There was a problem hiding this comment.
thanks for picking this up! fyi the table in the description is against main before #65487 landed, which already dropped the per-entry stat() and went to one binding call per directory, so most of that delta is gone. against current main (linux x64, means of 5 runs of this PR's benchmark, plus dir=test for a nested tree with 860 dirs / 13k entries) i get:
| main | this PR | |
|---|---|---|
promise, lib | 362 ops/s | 895 (+147 %) |
promise, test | 25.0 | 59.9 (+140 %) |
sync, lib | 850 | 1561 (+84 %) |
sync, test | 57.5 | 65.7 (+14 %) |
sync + withFileTypes, lib | 930 | 801 (−14 %) |
sync + withFileTypes, test | 55.4 | 56.8 (n.s.) |
any mode, test/parallel (flat) | n.s. |
so the promises path is the clear win (it awaited one thread pool round trip per directory), sync is a modest win, and withFileTypes sync regresses on small trees, which i think is the marshalling (comment below). could you rerun against current main and update the description please?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Aug 30, 2026
nodejs-github-bot
commented
Aug 31, 2026
nodejs-github-bot
commented
Aug 31, 2026
Fixes: nodejs#58892 Refs: nodejs#52663 Signed-off-by: avivkeller <me@aviv.sh>
nodejs-github-bot
commented
Sep 2, 2026
avivkeller
commented
Sep 2, 2026
Landed in 927dfad |
Currently, when recursively reading a directory, we do a few things which can be considered slow:
lstatover the JS version.Benchmarks:
Also,
Fixes#58892