-
Notifications
You must be signed in to change notification settings - Fork 229
Reduce allocations under SyntaxNodeExtensions.GetContent #11946
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using Microsoft.AspNetCore.Razor.PooledObjects; | ||
| using Microsoft.CodeAnalysis.CSharp; | ||
|
|
||
| namespace Microsoft.AspNetCore.Razor.Language.Syntax; | ||
|
|
@@ -303,11 +302,7 @@ public static TRoot InsertNodesAfter<TRoot>(this TRoot root, SyntaxNode nodeInLi | |
|
|
||
| public static string GetContent<TNode>(this TNode node) where TNode : SyntaxNode | ||
| { | ||
| using var _ = StringBuilderPool.GetPooledObject(out var builder); | ||
| using var writer = new System.IO.StringWriter(builder); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really don't think you need to worry about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's what I was hoping. Went ahead and changed to always use InvariantCulture. Thanks! |
||
| node.Green.WriteTo(writer); | ||
|
|
||
| return writer.ToString(); | ||
| return node.Green.ToStringInCurrentCulture(); | ||
| } | ||
|
|
||
| private sealed class DiagnosticSyntaxWalker(List<RazorDiagnostic> diagnostics) : SyntaxWalker | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right above here is where ToString instead specifies InvariantCulture.
If these were to match, the ToStringInCurrentCulture change could be moved to ToString.