profile
viewpoint

Ask questionsfs.Dir.read() is very slow

  • 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

nodejs/node

Answer questions Fishrock123

@piyukore06 Please let us know if you need any help making that PR. It'l require a bit of C++, but only a little bit.

useful!

Related questions

--max-http-header-size= is not allowed in NODE_OPTIONS
Crash with "req.handle.writev is not a function" on Socket.Writable.uncork hot 2
pkg-exports: "." errors without a specified `main` hot 2
shutdown ENOTCONN on TLS.Socket._final hot 2
HTTP/2 requests eventually start throwing NGHTTP2_ENHANCE_YOUR_CALM errors hot 2
Assertion `(parser->current_buffer_len_) == (0)' failed hot 1
Node.js 12.10 throwing EPROTO on HTTPS request hot 1
Remove util.inherits usage internally? hot 1
[Bug] Node 10.1.0 TLS issue with ldap: Client network socket disconnected before secure TLS connection was established hot 1
ReferenceError: internalBinding is not defined hot 1
Incorrect timezone hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
crypto, bad decrypt hot 1
stream.finished behaviour change hot 1
Github User Rank List