-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Background tokenization is a lot slower in large files #138887
Comments
When I saw the video, I immediately thought that this must be a recent regression. But in my attempt to track down the first bad commit, I have tried with our releases from the past 6 months, and then jumped all the way back to 1.40.2 from October 2019 and I always get the current behavior. Basically, changing the text buffer never ran a viewport tokenization, which is quite an oversight, but not a recent regression. |
@alexdima You're right, if start VS Code on a large file (like |
@ahejlsberg You're right, tokenization is now running for 2ms, and then yielding for 14ms, making it roughly 8 times slower: I think this bad yielding behavior is caused by #137646 , where we moved away from |
I've created #139072 to track that typing does not trigger viewport tokenization and I suggest to use this issue to track that background tokenization takes a lot longer now. |
…ll yielding as often as possible (#138887)
Steps to verify:
|
Verified. Took ~11 seconds on my machine. |
Something @ahejlsberg and I noticed in a recent meeting - if you open up
checker.ts
in TypeScript today, it quicky colorizes the area of the file you're viewing; however, if you start adding a function declaration towards the middle or bottom of the file, colorization takes a noticeable bit of time unless you try scrolling. Scrolling seems to get a bunch of content "fixed", and new text only gets the right colorization on scroll.Here's a video of some of this in action.
highlighting-initial-file-load.mp4
Eventually, the file starts to always get accurate colorization and smart-indentation, but it took at least over 30 seconds from what we remembered seeing.
This occurs in VS Code's latest (1.63 I believe) along with Insiders, both on Windows.
Closest similar issue I could find was #138822
The text was updated successfully, but these errors were encountered: