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
Performance: Async Syntax Highlighting #922
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glennsl
reviewed
Dec 5, 2019
glennsl
reviewed
Dec 5, 2019
glennsl
reviewed
Dec 5, 2019
glennsl
reviewed
Dec 5, 2019
glennsl
reviewed
Dec 5, 2019
bryphe
force-pushed
the
experiment/syntax-service-v2
branch
from
December 13, 2019 02:05
89d2831
to
218eede
Compare
bryphe
changed the title
[WIP] Performance: Async Syntax Highlighting
Performance: Async Syntax Highlighting
Dec 13, 2019
/azp run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a follow-up to #866 - the issue being that, even though our textmate syntax highlighting (
reason-textmate
is faster than the JS syntax highlighting strategy when run in isolation: https://github.com/onivim/reason-textmate#performance ) - it's actually slower in wall-clock time when run in the editor.The problem is that we are 'time-slicing' our syntax highlighting - giving it a budget of 2ms per frame. This means we are running it at 1/8 the potential speed (assuming a frame time of 16ms) - essentially 8x slower.
#866 was an attempt to move this to an OCaml thread to run in parallel, but unfortunately this is where the lack of multicore is problematic - most the of operations are CPU bound (the processing of the regex), so it causes delays in the rendering / responsiveness. When multicore is in place - threading will be a viable option, and we can revisit!
However, without OCaml multicore, we have to go back to running the syntax highlighting in a separate process - this will allow us to still get parallelism. The implementation can be simpler and more performant than our previous node-textmate strategy, which used JSON-RPC, because we can use OCaml's efficient
Marshal
module as the bridge, and we can strongly-type both ends of the protocol in Reason, and leverage the nativereason-textmate
parsing (andreason-tree-sitter
.TODO:
Oni_Syntax_Server
SyntaxHighlighting.t
thereOni_Syntax_Server
getUpdatedLines
to job / interfaceclearUpdatedLines
to job / interfacegetUpdatedLines
to job / interfaceclearUpdatedLines
to job / interfacerei
interfaces + review and consolidateDebug issue where new characters are not highlighted with previous token(this was an pre-existing issue, will test further to explore a fix in separate PR)Turn on 'C' tree-sitter?(will defer to a separate change)... later - keyword extraction would be nice to have!