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

Extension causes high cpu load #35

Closed
nkprince007 opened this issue Dec 22, 2020 · 10 comments
Closed

Extension causes high cpu load #35

nkprince007 opened this issue Dec 22, 2020 · 10 comments

Comments

@nkprince007
Copy link

  • Issue Type: Performance
  • Extension Name: markdown-table-formatter
  • Extension Version: 2.1.3
  • OS Version: Linux x64 5.9.11-3-MANJARO
  • VSCode version: 1.52.1

⚠️ Make sure to attach this file from your home-directory:
⚠️/tmp/fcrespo82.markdown-table-formatter-unresponsive.cpuprofile.txt

Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load

@fcrespo82
Copy link
Owner

Sorry for the looooong delay on this.

Are you still seeing this issue?

If yes, can you please upload the cpuprofile file.

@brunnerh
Copy link

I might have a way to reproduce this:

  • Create new JavaScript file
  • Write HTMLElement
  • Call command Go to Definition

This should open up the type declaration file lib.dom.d.ts, which is huge (my version has around 19k lines).
Doing this causes some very long or infinite processing, essentially taking out the extensions host.

Why is the extension running on non-markdown files, though?

@fcrespo82
Copy link
Owner

Thanks for the feedback.

Why is the extension running on non-markdown files, though?

It shouldn't, I'll look into it as soon as possible.

@fcrespo82
Copy link
Owner

fcrespo82 commented Aug 23, 2021

Hey @brunnerh, I couldn't reproduce the way you told. Maybe you enabled the extension to the typescript language by mistake?

Please look at your settings, look for the key markdown-table-formatter.markdownGrammarScopes and tell me if it was the case, please.

I will continue to search for other ways to mitigate this kind of problem, but for now I will add a confirmation dialog to avoid the extension being enabled on other languages by mistake...

@brunnerh
Copy link

Oh, you are correct, for some reason this setting has been modified, but i do not know why. Possibly because at some point i created tables in documentation texts and wanted to format them.

"markdown-table-formatter.markdownGrammarScopes": [
	"markdown",
	"csharp",
	"svelte",
	"typescript"
],

Still, the extension does not seem to handle large files too well and/or different languages cause it trouble. Maybe that could be improved?

@fcrespo82
Copy link
Owner

Of course it should handle large files better, this is now my priority.

Thanks again.

@fcrespo82
Copy link
Owner

Hey @brunnerh and @nkprince007 I think I was able to solve the high CPU load.

Can you folks test with this pre-release version, and give me feedback?

@brunnerh now it should parse the 19k file in less than 2s, it was the results I got in my tests.

Thanks in advance.

@brunnerh
Copy link

Tested it and it appears to not cause any issues anymore. 👍

@fcrespo82
Copy link
Owner

Glad to hear. I'll make some more tests today, and then release it later today, or tomorrow.

Thanks for the feedback and helping identifying the problem.

fcrespo82 added a commit that referenced this issue Aug 25, 2021
@fcrespo82
Copy link
Owner

Should be fixed in v2.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants