Skip to content

Slowness #9

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

Open
jeff-hykin opened this issue Jul 27, 2019 · 6 comments
Open

Slowness #9

jeff-hykin opened this issue Jul 27, 2019 · 6 comments
Labels
📖 Discussion Deciding how something should work

Comments

@jeff-hykin
Copy link
Owner

jeff-hykin commented Jul 27, 2019

@georgewfraser @EvgeniyPeshkov
This issue isn't anything new, it takes a bit for the colors to be updated by the extension. I'm making this issue because I've been thinking more about the tree sitter and I'm not sure where the slowness is coming from. The parser should be much faster than Textmate, and it seems you guys are updating the tree (rather than re-parsing the whole thing on every change).

Do you guys know if it has to do with how often the event occurs (not triggered fast enough), or if it's a decoration issue, or something related to iterating over the nodes?

@jeff-hykin jeff-hykin added the 📖 Discussion Deciding how something should work label Jul 27, 2019
@jeff-hykin
Copy link
Owner Author

I have a potential solution for the theme-colors issue, but it will likely have a computational cost so I'm trying to figure out where performance can be improved and considering if we need to get creative with moving more of the computation inside of Wasm/C++

@georgewfraser
Copy link
Collaborator

The setDecorations API is expensive in VSCode. That is why I use textmate for the simple colors, and tree-sitter only for the tricky ones. You can see some detailed profiling in this PR: microsoft/vscode-go#2555

@jeff-hykin
Copy link
Owner Author

Hmm do you think Textmate is using something other than setDecorations()?

@matter123
Copy link
Collaborator

vscode-textmate produces binary tokens that represent the current color and font style of the text. vscode then maps those tokens to css classes.

@jeff-hykin
Copy link
Owner Author

jeff-hykin commented Jul 28, 2019

So they're effectively just toggling a css class, and the text nodes in the DOM are being split up based on the textmate scopes? The DOM changes might be expensive but the CSS classes would be a significant advantage over setDecorations

@jeff-hykin
Copy link
Owner Author

Looks like VS Code is taking this issue seriously microsoft/vscode#77140

That issue is likely the main blocking issue for the tree-sitter right now

jeff-hykin pushed a commit that referenced this issue Aug 3, 2021
Fixed an exception that crashed the extension due to invalid language.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 Discussion Deciding how something should work
Projects
None yet
Development

No branches or pull requests

3 participants