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

Fix VSTHRD110 performance #1124

Merged
merged 2 commits into from
Dec 16, 2022
Merged

Fix VSTHRD110 performance #1124

merged 2 commits into from
Dec 16, 2022

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Dec 8, 2022

This analyzer was coded up to exhaustively search the entire global namespace of symbols for GetAwaiter methods for every single invocation in the compilation. Ugh.

Since VSTHRD200 was using the same slow code as the 110 analyzer, I also re-coded VSTHRD200. But VSTHRD200 isn't an IOperation analyzer so the SemanticModel isn't available, so the solution we use for both is a (slightly faster) exhaustive search for all GetAwaiter methods, which we then cache and reuse throughout the Compilation instead of reconstructing for every invocation.

In ETL traces, this brought the VSTHRD110 analyzer contribution to the build time of the StreamJsonRpc repo down from 5 seconds to 1. The time it takes is now mostly proportional to the number of projects (and the number of their references) rather than proportional to the size of the project itself.

Fixes #971

This also converts the analyzer to an IOperation analyzer and makes it work for VB.

Fix microsoft#971
@AArnott AArnott added this to the v17.5 milestone Dec 8, 2022
@AArnott AArnott merged commit 1738f83 into microsoft:main Dec 16, 2022
@AArnott AArnott deleted the fix971 branch December 16, 2022 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Performance of VSTHRD110
2 participants