-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Prevent StringBuilder resizes during SyntaxNode.GetText #70447
Prevent StringBuilder resizes during SyntaxNode.GetText #70447
Conversation
In the profile I'm looking at, CSWin32.SourceGenerator is the primary caller of this method, but the extractmethod coderefactoring provider also works it's way into this code.
@tarekgh do you know who could look at this? |
@jkoritzinsky are you the right person to answer questions regarding CSWin32.SourceGenerator? |
@AArnott is one of the owners of CsWin32. He'll know who to contact. |
I maintain CsWin32 pretty exclusively. Is there a more efficient way for CsWin32 to be doing something? If so, I'm happy to make the fix. |
@dotnet/roslyn-compiler PTAL |
Generally, it would be good for an SG to not use syntax nodes as an intermediary representation. They're massively expensive. See the convo on using a simple indenting string writer. If intermediary values need to be stored, keeping it as a simple string which can be blitted to the final doc would be ideal. |
@CyrusNajmabadi Understood. I know the thread you're talking about and you make some solid arguments. But what you suggest will be a massive rewrite of CsWin32, so it's not likely to happen soon. As I think I mentioned over at that other thread, I might work it in as part of the rewrite to enable incremental source generation. |
@AArnott Sounds good :) |
In the profile I'm looking at, CSWin32.SourceGenerator is the primary caller of this method, but the ExtractMethodCodeRefactoringProvider also works it's way down into this code via SemanticDocument.CreateAsync.