Skip to content
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

VSCode unresponsive while generating very large tooltip while editing C file #7577

Closed
vgf89 opened this issue May 22, 2021 · 7 comments
Closed
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service performance quick fix
Milestone

Comments

@vgf89
Copy link

vgf89 commented May 22, 2021

Bug type: General

Describe the bug

  • OS and Version: Windows 10 1909
  • VS Code Version: 1.56.2
  • C/C++ Extension Version: 1.3.1
  • Other extensions you installed (and if the issue persists after disabling them): Only the C/C++ plugin is necessary to reproduce. Every other plugin can be uninstalled
  • A clear and concise description of what the bug is.

I have a particularly large array of structs that I instantiate and that the C/C++ plugin has trouble with. Open https://github.com/vgf89/gbemu/blob/579fbcee1693456c66374bace0940c637062a837/cpu.c and hover over any of the "{" or "}" in the instructions struct array (starts on line 19), and observe how VSCode freezes for multiple seconds.

If you don't move the mouse, a very very long tooltip of all of the list values appears when the lag ends. I'm not sure why the C/C++ plugin tries to generate this tooltip, and I especially don't like that it completely freezes the UI for multiple seconds while doing so.

To Reproduce
Please include code sample and task.json files.
Steps to reproduce the behavior:

  1. open https://github.com/vgf89/gbemu/blob/579fbcee1693456c66374bace0940c637062a837/cpu.c in VSCode
  2. hover the mouse over the "{" bracket at the end of line 19, or any of the "{" or" }" brackets inside of the list.
  3. Observe how VSCode freezes for ~5 seconds, and watch VSCode CPU usage spike in Task Manager.

Expected behavior

VSCode shouldn't freeze when mousing over value instantiation list brackets in my c file. The tooltip it generates while doing so is also of dubious usefulness.

Screenshots

Additional context

This happens on both my laptop and much more powerful desktop, and even happens with NO other plugins installed besides the C/C++ plugin.

Here's a profile of the freeze captured from the debugger:
https://gist.github.com/vgf89/4719a0d13ebdfd1d8cdd76bf0c6ad259

@vgf89 vgf89 changed the title VSCode unresponsive while generating very large tooltip in C file VSCode unresponsive while generating very large tooltip while editing C file May 22, 2021
@sean-mcmanus sean-mcmanus self-assigned this May 24, 2021
@sean-mcmanus
Copy link
Collaborator

This is a duplicate of #7334 and fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.4.0-insiders2

@sean-mcmanus sean-mcmanus removed their assignment May 24, 2021
@vgf89
Copy link
Author

vgf89 commented May 25, 2021

I just installed the 1.4.0-insiders2 plugin version. The freezes are only about a second now. That's a massive improvement and makes this more bearable. Now it's just a mild annoyance. Thanks for the update!

@sean-mcmanus
Copy link
Collaborator

The fix was to limit the hover result to 10000 characters...it sounds like you're suggesting the limit be made even lower? Is there some particular case where the second lag is particularly a problem? (i.e. a second lag can be "normal" for many IntelliSense operations).

@vgf89
Copy link
Author

vgf89 commented May 26, 2021

My main gripe is that it still freezes the UI. AFAIK most suggestion, auto complete, and styling operations don't do that (though I could be wrong about that, for all I know those all run in a UI thread but are fast enough to not cause noticeable hitches). If the tooltip took an extra second to appear but left the rest of the UI responsive, or could be interrupted by user input, I'd be very happy, but admittedly I don't know at all how VSCode or its plugin API work so I have no idea how hard that is to do. Also if the lag is from VSCode trying to render that tooltip, maybe the primary performance issue lies upstream? Idk, just spitballing

I will say that the 1 second lags I get when working in the literals list are very much bearable compared to the 5 second lags I had previously, so I thank you for that. I don't believe this is a serious issue anymore, it's just something that raises my eyebrow a little.

@sean-mcmanus
Copy link
Collaborator

Yeah, I'm not able to repro any UI freeze at all and I believe the root issue is VS Code's rendering.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented May 26, 2021

Ah, there's no lag with local Windows, but I see the UI freeze when remoting to Linux. Should be easy to fix...

UPDATE: Should be fixed with 1.4.0 (not released yet)...hover display limit for literals is now 1100 characters, which is before the vertical scrollbar becomes visible.

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label May 26, 2021
@sean-mcmanus
Copy link
Collaborator

@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service performance quick fix
Projects
None yet
Development

No branches or pull requests

2 participants