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

Markdown All in One consumes a lot of CPU cycles on startup with large workspaces #12

Closed
rbolsius opened this issue Jul 12, 2017 · 5 comments

Comments

@rbolsius
Copy link
Contributor

When opening VS Code with a workspace containing a large number of files and the Markdown All in One extension enabled, the searchService process started by VS Code consumes a lot of CPU cycles for several minutes, which unnecessarily drains battery power.

The process consuming the CPU has the following command arguments:

C:\programs\editors\vscode\Code.exe c:\programs\editors\vscode\resources\app\out\bootstrap --type=searchService

When Markdown All in One is disabled, VS Code consumes very few CPU cycles on startup. I think the source of the heavy CPU usage is the "workspaceContains" activation event:

"activationEvents": [
"onLanguage:markdown"
"workspaceContains:*.md"
]

If I remove the workspaceContains event and leave just the "onLanguage:markdown" event, the extension is very light on startup.

"activationEvents": [
"onLanguage:markdown"
]

With the "workspaceContains:*.md" activation event, the extension is so heavy on CPU, I have to disable it or modify the package.json if I want to use it.

@yzhang-gh
Copy link
Owner

Oh, I see. Really good catch. Thanks a lot 👍

@yzhang-gh
Copy link
Owner

Can you please give a try on this new version?

I use * in activationEvents and then use vscode.workspace.findFiles to determine whether to activate extension.

@rbolsius
Copy link
Contributor Author

The 0.7.4 preview version using vscode.workspace.findFiles loads very quickly. There is no perceptible difference in startup time with the extension enabled or disabled. It seems like vscode.workspace.findFiles respects the workspace file exclusion filters while workspaceContains does not. So, the fix looks good to me.

@yzhang-gh
Copy link
Owner

Happy to hear that. I'll publish it soon.

@rbolsius
Copy link
Contributor Author

Thanks for amazingly quick fix and keep up the great work!

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

2 participants