Use syntaxtrees in incremental processing to avoid unnecessary work#62071
Merged
CyrusNajmabadi merged 8 commits intodotnet:mainfrom Jun 27, 2022
Merged
Use syntaxtrees in incremental processing to avoid unnecessary work#62071CyrusNajmabadi merged 8 commits intodotnet:mainfrom
CyrusNajmabadi merged 8 commits intodotnet:mainfrom
Conversation
CyrusNajmabadi
commented
Jun 22, 2022
|
|
||
| var syntaxTreesProvider = _context.CompilationProvider.SelectMany((c, _) => c.SyntaxTrees); | ||
| var individualFileGlobalAliasesProvider = syntaxTreesProvider.Select( | ||
| (s, c) => getGlobalAliasesInCompilationUnit(syntaxHelper, s.GetRoot(c))).WithTrackingName("individualFileGlobalAliases_ForAttribute"); |
Contributor
Author
There was a problem hiding this comment.
CyrusNajmabadi
commented
Jun 22, 2022
...ilers/Core/Portable/SourceGeneration/Nodes/SyntaxValueProvider_ForAttributeWithSimpleName.cs
Outdated
Show resolved
Hide resolved
…Provider_ForAttributeWithSimpleName.cs
jaredpar
approved these changes
Jun 22, 2022
…badi/roslyn into syntaxTreeIncremental
jcouv
reviewed
Jun 22, 2022
| static (n, _) => n is ICompilationUnitSyntax, | ||
| static (context, _) => context.Node).WithTrackingName("compilationUnit_ForAttribute"); | ||
| var compilationUnitProvider = syntaxTreesProvider.Select( | ||
| (t, c) => t.GetRoot(c)).WithTrackingName("compilationUnit_ForAttribute"); |
Member
There was a problem hiding this comment.
static?
Suggested change
| (t, c) => t.GetRoot(c)).WithTrackingName("compilationUnit_ForAttribute"); | |
| static (t, c) => t.GetRoot(c)).WithTrackingName("compilationUnit_ForAttribute"); | |
| ``` #Closed |
Contributor
Author
There was a problem hiding this comment.
actually, noticing this, this is bad. we don't want to hold onto the roots of all the trees (as that will prevent them from being GC'ed). moving this to only hold the syntax tree, and to delay getting the root until necessary.
jcouv
approved these changes
Jun 22, 2022
Member
jcouv
left a comment
There was a problem hiding this comment.
LGTM Thanks (iteration 5) with a nit
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This drops the time of the benchmark from 15 seconds to 10, and drops allocations from 15GB to 12.5GB.Above data was for only updating one call. Updating both drops us from 15 seconds to 3.3, and from 15B to 4.7GB