-
Notifications
You must be signed in to change notification settings - Fork 509
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
Improve state management in analyzers #1671
Conversation
Current coverage is
|
👍 Looks good to me. There is a risk that the new cache is not effective if the any analyzer is called concurrently for multiple compilations. |
@mavasani @tmeschter Are the compilation start actions for multiple
However, the following ordering would eliminate all benefits of the cache:
|
Are the compilation start actions for multiple Compilation instances invoked in parallel? - The answer is yes and no :) For background analysis which populates the error list. we currently execute analyzers sequentially and never move back to an older compilation - so the callbacks should be as per your first ordering. For user facing operations where we have the UI thread and can execute analysis concurrently (such as FixAll occurrences across project or solution scope), we execute the analyzers concurrently across documents, each of which forks a different CompilationWithAnalyzers, so the second ordering is very likely. Note that both of these are implementation details that can change anytime based on our perf investigations - I wouldn't rely on it for your caching logic. Having said that, I totally agree with your current PR of getting rid of the static conditional weak table - they are purely evil for IDE analyzer perf. I personally feel its an overkill to require analyzer authors to perform state and lifetime management for shared state across analyzer instances - I am going to open a work item on our GitHub repo, provide a proposal and loop you into the design discussions. |
Compilation
instead of once per syntax treeConditionalWeakTable<TKey, TValue>