You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was diagnosing performance of an app scanning node_modules. It turned out half of the time is spent in isDirectory on the few cases where it was looking for a missing folder.
What helped was passing in an isDirectory implementation that bails out if the path has gone out of the current folder.
For cases of using resolve hundreds of thousands of times in a build process etc. doing a full tree folder listing and caching it would provide a great deal of performance improvement.
For that purpose, setting isDirectory and other helper functions on the resolve module singleton instead of drilling them down to where it's called would be useful.
Is that an interesting/welcome contribution?
The text was updated successfully, but these errors were encountered:
I don't mean adding state but exposing the default implementations of helper functions so they can be overwritten.
My previous description was... written in a rush and a bit messy.
If I could do resolve.defaults.isDirectory = myfunc that'd be it
If that's also considered unwanted state, I'm convinced I need to work on a different angle for this. Maybe I'll monkey patch fs 😉
I was diagnosing performance of an app scanning node_modules. It turned out half of the time is spent in isDirectory on the few cases where it was looking for a missing folder.
What helped was passing in an isDirectory implementation that bails out if the path has gone out of the current folder.
For cases of using
resolve
hundreds of thousands of times in a build process etc. doing a full tree folder listing and caching it would provide a great deal of performance improvement.For that purpose, setting isDirectory and other helper functions on the
resolve
module singleton instead of drilling them down to where it's called would be useful.Is that an interesting/welcome contribution?
The text was updated successfully, but these errors were encountered: