-
Notifications
You must be signed in to change notification settings - Fork 0
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
minimize fs calls #2
Comments
@es128 @kmalakoff I have had bad experiences doing eager
|
I tried both of your advice, but I couldn't get a faster running verion.
The original still seems to perform the best. Any ideas? Feel free to restructure and submit a pull request to try to beat it. |
I've published a refactored library using an asyncIterator API. See fs-iterator Also, I ran performance tests against readdirp. |
For performance reasons, the less calls to fs methods, the better.
Currently, path entries go through a chain of
stat
->realPath
->readdir
(the last one only for confirmed dirs). But I think it would be better to refactor to something more like:Then after that do
stat
and/orrealPath
if requested based on opt-in parameters (or keep it simple and just leave it up to the consumer to do on their own).It could even be possible to allow a really aggressive strategy of assuming that any entry that is named like a file (
/\.\w{1,4}$/
) is a file and skipping thefs.readdir
.I discussed the same sort of idea in paulmillr/readdirp#24, but when I really looked at it it turned out to seem to be too complex a change to slide into readdirp. I had planned to work on it as a new module soon after knocking down some of the bugs in chokidar that had been reported during my less OSS-active period this year (one of those bugs btw was directly caused by readdirp always using
realPath
, which is another motivation for not doing it here or making it optional). And then you came along and made this.It would represent a really significant change to the strategy employed here so far (almost a complete rewrite possibly), but if you're cool with the concept I'd be happy to collaborate on moving in this direction here rather than work on it in a new project.
The text was updated successfully, but these errors were encountered: