Skip to content

fs.Dir.read() is very slow #29941

Closed
Closed
@paulmillr

Description

  • Version: 12.12.0
  • Platform: macOS catalina
  • Subsystem: FS

I maintain the popular readdirp module. Decided to try fs.opendir from node 12.12. The results are suboptimal: it's 3x slower to walk file trees when compared to fs.readdir.

To reproduce:

  1. Check out the gist: https://gist.github.com/paulmillr/4e3a4da2ad8e98cf0fe7dc819242532a
  2. By switching logic from if (opendir) to if (!opendir) I get 3x speedup, which means opendir is 3x slower than readdir.

Refs: #583, #29349

Metadata

Assignees

Labels

fsIssues and PRs related to the fs subsystem / file system.performanceIssues and PRs related to the performance of Node.js.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions