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 in outlining in pathlogical files #68522

Merged
merged 5 commits into from
Jun 9, 2023

Conversation

CyrusNajmabadi
Copy link
Member

We're seeing traces where the allocations here show up. This would happen in files that have a massive amount of string literals in them. Mitigating cases where we could not need code folding here.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 9, 2023 20:16
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 9, 2023
@@ -19,7 +20,8 @@ internal sealed class StringLiteralExpressionStructureProvider : AbstractSyntaxN
CancellationToken cancellationToken)
{
if (node.IsKind(SyntaxKind.StringLiteralExpression) &&
!node.ContainsDiagnostics)
!node.ContainsDiagnostics &&
CouldBeMultiLine())
Copy link
Member Author

Choose a reason for hiding this comment

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

we don't bother running on string literals we know to be single line.


namespace Microsoft.CodeAnalysis.Structure
{
internal sealed class BlockStructureContext
internal readonly ref struct BlockStructureContext
Copy link
Member

Choose a reason for hiding this comment

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

❗ Use a non-copyable non-ref struct

@CyrusNajmabadi CyrusNajmabadi merged commit 7a43937 into dotnet:main Jun 9, 2023
24 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the stringFolding branch June 9, 2023 22:39
@ghost ghost added this to the Next milestone Jun 9, 2023
@RikkiGibson RikkiGibson modified the milestones: Next, 17.7 P3 Jun 28, 2023
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.

None yet

3 participants