Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: buffer dir entries in opendir() #29893

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! fixup! fs: buffer dir entries in opendir()
  • Loading branch information
addaleax committed Oct 11, 2019
commit 751a8b603b21b9db1e3d942d13d522843ab17eeb
10 changes: 6 additions & 4 deletions benchmark/fs/bench-opendir.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ async function main({ n, dir, mode }) {
await new Promise((resolve, reject) => {
function read() {
dir.read((err, entry) => {
if (err)
if (err) {
reject(err);
if (entry === null)
} else if (entry === null) {
resolve(dir.close());
else
} else {
counter++;
read();
}
});
}

read();
});
} {
} else {
const dir = fs.opendirSync(fullPath);
while (dir.readSync() !== null)
counter++;
Expand Down