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

Keep as much parsed state as we can when producing frozen compilations #72184

Merged
merged 12 commits into from
Feb 23, 2024

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 20, 2024
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review February 22, 2024 21:49
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner February 22, 2024 21:49
@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski @ToddGrun this is ready for review.

return state switch
{
// If we don't have an existing state, then transition to a project state without any data.
null => this.ProjectState,
Copy link
Member Author

Choose a reason for hiding this comment

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

intentionally changes. teh RemoveAllDocuments is now in GetFrozenCompilationState

Copy link
Member

Choose a reason for hiding this comment

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

If that's the case then update the comment.

Copy link
Member

Choose a reason for hiding this comment

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

And at this point, I just want to see GetIniitalProjectState combined with the other function. There's now two functions that both have the same switches and you can only understand how this works if I look at both of them at once. It's far more cognitive load to understand the structure than just one bigger method here.

@@ -641,35 +641,41 @@ public ICompilationTracker FreezePartialState(CancellationToken cancellationToke
if (state is FinalCompilationTrackerState { IsFrozen: true } finalState)
return this;

var projectState = state switch
Copy link
Member Author

Choose a reason for hiding this comment

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

view with whitespace off.

}
}

frozenProjectState = frozenProjectState.AddDocuments(documentsWithTrees.ToImmutableAndClear());
Copy link
Contributor

Choose a reason for hiding this comment

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

AddDocuments

I'm probably a bit sensitive as this is what I'm trying to remove in some of my PRs, but this feels like something we might see in allocation profiles. AddDocuments doesn't really need it's input to be immutable, does it?

Copy link
Member Author

Choose a reason for hiding this comment

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

i'd prefer to drive this based on allocation profiles. immutable types really help us ensure no mistakes.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

return state switch
{
// If we don't have an existing state, then transition to a project state without any data.
null => this.ProjectState,
Copy link
Member

Choose a reason for hiding this comment

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

And at this point, I just want to see GetIniitalProjectState combined with the other function. There's now two functions that both have the same switches and you can only understand how this works if I look at both of them at once. It's far more cognitive load to understand the structure than just one bigger method here.

@CyrusNajmabadi CyrusNajmabadi merged commit 802d04c into dotnet:main Feb 23, 2024
25 of 27 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the preserveParsing branch February 23, 2024 03:40
@jjonescz jjonescz added this to the 17.10 P2 milestone Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants