-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve AddImport conflict detection performance (#73780)
* Improve add import conflict detection performance We've recently obtained some traces from customers around ui delays during completion commit in C# files. The first profile I took a look at indicated that the delay was due to committing a snippet, and in particular during the code used to prevent adding conflicting imports. This code has been improved in 3 ways, all relating to accessing the semantic model (where the *vast* majority of the time was spent): 1) Reduce the number of nodes for which semantic information need be obtained. The code already collects a couple dictionaries keyed on type names which could cause conflicts. This simply changes the code to filter syntax nodes based on this. 2) Change the kind of semantic model used. About half the time used during the binding process was due to the model dealing with work around nullability. We don't need that infomation, so we're good to use the much faster nullabledisabled semantic model. 3) Process all the binding of nodes to their semantic info in parallel. This does a simple collection of nodes of interest, then uses the ProducerConsumer mechanism to obtain semantic information in parallel. As a minor tweak, I aslo did away with the TreeWalker derivation, instead just doing a simple walk over the results of GetDescendantNodes. Should be more performant, and I find it a bit easier to understand when the needs are this simple.
- Loading branch information
Showing
5 changed files
with
241 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.