-
Notifications
You must be signed in to change notification settings - Fork 30
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
Major performance regression in certain files starting with 1.9.4 -- 100% CPU for about 1 minute #218
Comments
I ran the profiler -- it's showing vscode-textmate matchRule taking all the time. |
I got the repro down to 91 lines (the CPU usage lasts only around 10 sec though). Invoking Developer: Inspect TM Scope causes major blockage "forever" until I reload. I don't see anything unusual in the code. |
The reproduction case would certainly be helpful. The only significant difference between v1.9.3 and v1.9.4 is support for default arguments in function definitions a048985, and all those patterns were preexisting. |
Here's a repro -- I've replaced all the identifiers with "a". Freeze is 10-15 seconds -- more with Developer: Inspect TM Scope enabled. 1.9.3 has 0 seconds freezing. Repros with VS Code non-Insiders too.
|
@jeff-hykin The issue seems to be that function_definition is allowed inside of the function parameters. vscode-textmate spends about half of its time (4700ms) to determine that Edit: |
It looks like the performance issue is with generateScopeResolutionFinder. when the pattern is forced to be atomic the total time becomes .91s. This causes other issues with matching so it's not a solution, but hopefully, the scope resolution generator can be made non-backtracking. |
No I don't, and I can't think of a reason why it would intentionally be there. If removing it solves the issue, then we should definitely remove it. It's still unclear to me why :function_definition would cause this, especially with backtracking disabled. It could be related to the look-arounds. I'm going to be without a computer tomorrow so I'm going to try to look into the issue now. |
Thanks @sean-mcmanus for posting the example code |
This is strange
However this is near unusably slow:
Something is going on with the matching of whitespace. |
Fix pushed with version The fix corrects the :function_call_context was including :block and :block was including :$initial_context, so Now that the Objective-C and Objective-C++ syntaxes are fixed though, we can finally go through and clean up all the contexts and stop including With that said, @matter123 I'm still not sure what was causing it to be so slow by simply adding whitespace. On another day I'm going to try to find which pattern was causing that. |
Thanks, that fixed the issue with my 2.4k line file as well. |
Certain .cpp files make VS Code unusuably slow due to high 100% CPU usage on one core (extension host process) starting with 1.9.4 -- the issue doesn't repro with 1.9.3. It repros without our C/C++ extension. Could it be caused by https://github.com/jeff-hykin/cpp-textmate-grammar/pull/199/files ?
The repro we have has 2349 lines in it. Let me know if you guys need help getting a better repro.
I'm using the latest VS Code Insiders.
The text was updated successfully, but these errors were encountered: