[WIP] perf: filter by ext on chokidar side #2111
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that nodemon uses a lot of CPU while watching my current project.
I investigated it and found that it is
chokidar
who consumes lots of resources. I found this issue paulmillr/chokidar#1162.I looked into the problem through the context of
nodemon
and found thatchokidar
watches all the files even if we are interested in files with specific extensions.So, I made this change paulmillr/chokidar#1274 and proposed it to the chokidar.
If talking in numbers, before that change, I had watched 29 892 files and had usage of CPU. It started from the range 198 - 203 at the beginning and stoped at level 217 - 219 after 5-10 restarts. if retrieved via
ps -C node -wwo pid,%cpu,%mem,cmd
After these changes, I started having 20 140 files watched and CPU usage at 173 - 181 at the beginning, which is a noticeable reduction for my system.
@remy and community, if you consider these changes to be a meaningful improvement, please help me get the PR paulmillr/chokidar#1274 merged.
Also, feel free to share your feedback if you see some improvements in the work I did.
Thanks in advance!