Closed
Description
- Version: master
- Platform: n/a
- Subsystem: fs
The current implementation of fs.existsSync
involves wrapping accessSync
in a try/catch statement. While conceptually simple, it has one fundamental flaw: it means that Node has to instance an Error
for each call to fs.existsSync
made on non-existing paths. This can end up very expensive.
Would it be possible to make this function more lightweight by simply checking the return value of the libuv's access call? I'm not familiar with the Node internals, but I feel like simply returning false
instead of calling handleErrorFromBinding
here would be sufficient.
Relevant lines:
Lines 229 to 236 in e35f671
Metadata
Metadata
Assignees
Labels
No labels