-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Starting with a TS/JS file is significantly file slower than opening other files #77990
Comments
root cause -- vscode/extensions/typescript-basics/package.json Lines 81 to 90 in c94b270
This injection drags in markdown, which drags in almost all our grammars... Removing that reduces the time significantly. |
I believe the core reason for this is the markdown grammar's fenced code block support. That ends up pulling in grammars for most of our builtin languages. Will see if including a subset of the markdown grammar fixes this or if we maybe need to split up the markdown grammar file in some way (note that we already do include subsets of the markdown grammar instead of pulling in the entire thing, but one of those subsets is the entire fenced code block set of rules) |
@mjbvz Good idea! I think going for a reduced subset is the right thing to do. I would also incorporate this into the TS grammar itself, the TS grammar already appears to do a lot of JSDoc parsing anyways, so why wouldn't Sublime and other editors where the TS grammar is used benefit from this... Also, IMHO we should avoid injection if possible and in this case I think it is possible because we can reach to the TS team who own the TS grammar and they can add the fenced block rule to their grammar if we would give them a PR. |
It's a bit complicated since fenced code blocks can appear inside other markdown elements, like lists, which we do want to support in jsdoc comments Sublime doesn't support some of the rules we need to support the jsdoc highlighting feature (microsoft/TypeScript-TmLanguage#693) so that why I went with the injection based approach I think we either need to:
I'll be looking into the first approach today |
After thinking about this more, I don't think we should do a js/ts specific fix. The same performance problem also exists when you load VS Code with a markdown file open. I've opened microsoft/vscode-textmate#106 that proposes loading referenced grammars lazily. This would fix the issue for js/ts and for normal md files too |
@mjbvz Let's remove the TS injection until we address microsoft/vscode-textmate#106 |
I am still seeing this in web. Steps:
|
It is unfortunate how this was never verified because it didn't have a |
Thanks! |
Thanks @alexandrudima! Sorry, I thought I had profiled when I made the original fix but clearly was not look at the right thing. You change looks much better |
@mjbvz there are other languages that will suffer from this issue too, should we fix them as well? For example I think F#, PHP, Perl. Probably anything that depends on markdown. |
I gave a spin at verifying this by measuring the total time spent in
This appears a good bit better than the ~300ms Johannes reported initially, though we're on different hardware and opening different files. @alexandrudima @jrieken are these measurements within the bounds that you'd consider this resolved? (Unlabel if not 🙂 ) |
Yeah, I have measure the same number. I think reasonable because the JSON grammar is trivial in comparison to the TS grammar. Tho, there is still #77990 (comment) which we should probably move into a separate issue |
This is all rather complicated, but we had to revert That would technically mean that this issue is reopened (with the revert). The lowest risk fix at this point is to revert |
The problem is the jsdoc injection which itself drags in the MD grammar which drags in the world...
The text was updated successfully, but these errors were encountered: