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

Reduce allocations and UI thread CPU costs in WithDoNotCreateCreationPolicy #75358

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Oct 2, 2024

This method shows up in the typing scenario in the new csharp editing speedometer test.

CPU: This method accounts for 5% of UI thread CPU activity during typing.
a) Removed the Enumerable.Count() call accounting for 1.7%. (Local testing showed limited value as there was typically a large number of states to iterate and a low number of syntax trees already realized)
image

Allocations: This method accounts for 7.9% of allocations during typing.
a) Removed ImmutableArray.Builder allocations: 0.2%
b) Removed most SyntaxTree[] allocations: 0.2% (local testing showed very low hit rate of lazyCompilationWithoutGeneratedDocuments evalutation)
c) Removed Enumerable.Count heap allocations due to boxing the ImmutableSortedDictionary enumerator: 0.1%
image

…Policy

This method shows up in the typing scenario in the new csharp editing speedometer test.

CPU: This method accounts for 5% of UI thread CPU activity during typing.
  a) Removed the Enumerable.Count() call accounting for 1.7%. (Local testing showed limited value as there was typically a large number of states to iterate and a low number of syntax trees already realized)

Allocations: This method accounts for 7.9% of allocations during typing.
  a) Removed ImmutableArray.Builder allocations: 0.2%
  b) Removed most SyntaxTree[] allocations: 0.2% (local testing showed very low hit rate of lazyCompilationWithoutGeneratedDocuments evalutation)
  c) Removed Enumerable.Count heap allocations due to boxing the ImmutableSortedDictionary enumerator: 0.2%
@ToddGrun ToddGrun requested a review from a team as a code owner October 2, 2024 22:46
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 2, 2024
@ToddGrun ToddGrun merged commit 1c815d7 into dotnet:main Oct 3, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Oct 3, 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 VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants