Watcher and initial load performance improvements #357
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.
stat
calls.readdir
calls.lstat
calls.I benchmarked using
stat
across 10k files, with the current batch settings it seems to result in around a 1.5-1.9 increase in speed when ran locally.I'm not sure what the optimal batch size and timeout are, but I played around with how responsive the terminal felt and went with something that seemed reasonable. During load the terminal is much more responsive, but we might be able to further improve.
Edit: It looks like the remaining lag on the terminal during load is due to either the client parsing all the messages sent back to it from all the batched calls or the server stringifying all those messages (probably some of both). I suppose the only way to make it better is to somehow make
JSON.parse
andJSON.stringify
asynchronous and low-priority for messages that don't need to be immediately responsive (maybe spawn a process or worker for those messages).Edit 2: Moving all the parsing/stringifying to separate threads using processes/workers might be a good idea?