-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Avoid task allocations for TextDocument.GetTextAsync #68090
Conversation
78ec53f
to
b4f4443
Compare
Updates production code to use GetValueTaskAsync or GetTextSynchronously, as appropriate, to avoid task allocations in a call to GetTextAsync.
b4f4443
to
020a2a4
Compare
var sourceText = await document.GetTextAsync().ConfigureAwait(false); | ||
var textContainer = sourceText.Container; | ||
return textContainer.TryGetTextBuffer(); | ||
}); |
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.
📝 This is the only one that changed significantly
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.
|
||
return new ValueTask<SourceText>(document.GetTextAsync(cancellationToken)); | ||
} | ||
#endif |
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.
i would be supportive of you makign an API proposal for this and going through public API review as well. (not blocking this PR of course).
Updates production code to use GetValueTaskAsync or GetTextSynchronously, as appropriate, to avoid task allocations in a call to GetTextAsync.