Skip to content

Reduce allocations in XmlDocumentationProvider.GetDocumentationForSymbol#80287

Merged
ToddGrun merged 2 commits intodotnet:mainfrom
ToddGrun:dev/toddgrun/XmlDocumentationProviderAllocations
Sep 16, 2025
Merged

Reduce allocations in XmlDocumentationProvider.GetDocumentationForSymbol#80287
ToddGrun merged 2 commits intodotnet:mainfrom
ToddGrun:dev/toddgrun/XmlDocumentationProviderAllocations

Conversation

@ToddGrun
Copy link
Copy Markdown
Contributor

Switches the method from XDocument usage to just using the XmlReader directly.

I do notice one slight difference between the two, the old way ends up converting "\n" in the document to "\r\n" whereas the new way doesn't do that conversion. I don't think that should have an effect on rendering, but I thought I should mention it.

XmlDocumentationProvider.GetDocumentationForSymbol accounts for 1.4% of total allocations in the ServiceHub process in the razor cohosting speedometer test. I haven't run an insertion against this, but I'm confident that this new way will reduce this number.

image

Switches the method from XDocument usage to just using the XmlReader directly. I do notice one *slight* difference between the two, the old way ends up \n in the document to \r\n whereas the new way doesn't do that conversion. I don't *think* that should have an effect on rendering, but I thought I should mention it.
@ToddGrun ToddGrun requested a review from a team as a code owner September 15, 2025 20:37
@ToddGrun
Copy link
Copy Markdown
Contributor Author

@dotnet/roslyn-ide -- ptal and let me know if you want me to kick off a perf run to get numbers with the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants