Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Watcher and initial load performance improvements #357

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

Merged
kylecarbs merged 5 commits into master from perf/watcher
Mar 27, 2019
Merged

Conversation

@code-asher
Copy link
Member

@code-asher code-asher commented Mar 27, 2019
edited
Loading

  • Set low CPU priority on the watcher on Linux (the lowest possible, 19).
  • Batch stat calls.
  • Batch readdir calls.
  • Batch 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 and JSON.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?

NGTmeaty and nol166 reacted with thumbs up emoji
@code-asher code-asher changed the title (削除) Watcher-related performance changes (削除ここまで) (追記) Watcher and initial load performance changes (追記ここまで) Mar 27, 2019
callbackify seems to always adds an error as the first argument. Opted
to just use the promise for this one.
@code-asher code-asher changed the title (削除) Watcher and initial load performance changes (削除ここまで) (追記) Watcher and initial load performance improvements (追記ここまで) Mar 27, 2019
@kylecarbs kylecarbs merged commit 259095e into master Mar 27, 2019
@kylecarbs kylecarbs deleted the perf/watcher branch March 27, 2019 22:04
code-asher added a commit that referenced this pull request Jun 19, 2019
* Set low CPU priority on watcher
Fixes #247.
* Batch stat and readdir calls
* Fix fs.exists
callbackify seems to always adds an error as the first argument. Opted
to just use the promise for this one.
* Batch lstat
* Add maximum time for flushing batches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kylecarbs kylecarbs Awaiting requested review from kylecarbs

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /