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

Various perf fixes to minimize linter CPU impact #3852

Merged
merged 10 commits into from
Aug 3, 2021

Conversation

anthony-c-martin
Copy link
Member

@anthony-c-martin anthony-c-martin commented Aug 2, 2021

Closes #3785

Changes:

  • Allow semantic models to be reused between compilations if the source file has not been modified and contains no dependencies on a source file which has been modified. This avoids constant re-running of linters (and other semantic analysis) across multiple module dependencies on every keypress.
  • De-duplicate semantic models between active compilation contexts if multiple files part of the same compilation are open. This minimizes the number of times the linters (and other semantic analysis) must be run.
  • Avoid processing resource type strings & module paths in the no-hardcoded-env-urls linter.
  • Add debug tracing framework for language server and CLI.

@anthony-c-martin
Copy link
Member Author

@miqm - I'd be very interested to see what sort of difference this change makes to performance with your file structure - if you get a chance to try it out.

Here's a link to the VSIX file from this PR: https://github.com/Azure/bicep/suites/3389732759/artifacts/79971841

The main changes I made:

  • Avoid regenerating semantic models for files which have not been changed, or contain no (direct or indirect) references to files which have changed.
  • De-duplicate semantic models across different compilations - e.g. if I've got a parent module and child module both open in the editor, there should be only one copy of the child semantic model.

I also added some LSP tracing so that you can see which semantic models are reloaded in real time.
image

@miqm
Copy link
Collaborator

miqm commented Aug 2, 2021

I’ll check it on Monday.

@anthony-c-martin anthony-c-martin marked this pull request as ready for review August 3, 2021 13:22
@anthony-c-martin anthony-c-martin changed the title Perf improvement - minimize cascading recompilations Various perf fixes to minimize linter CPU impact Aug 3, 2021
@anthony-c-martin anthony-c-martin enabled auto-merge (squash) August 3, 2021 22:15
if (singleLine.StartsWith("TRACE: "))
{
// trace messages (see TextWriterTraceListener)
this.Log.LogMessage(singleLine);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

singleLine

Should exclude the "TRACE: " prefix from what gets logged in msbuild.

Copy link
Member

@majastrz majastrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWESOME!

@anthony-c-martin anthony-c-martin merged commit bdda2d0 into main Aug 3, 2021
@anthony-c-martin anthony-c-martin deleted the antmarti/url_follow_up branch August 3, 2021 22:50
@miqm
Copy link
Collaborator

miqm commented Aug 9, 2021

@anthony-c-martin since it's merged I've downloaded latest main branch vsix and performance is awesome. looking forward for the release.

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

Successfully merging this pull request may close these issues.

Reuse semantic models where possible when recompiling modules
3 participants