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

Perf improvements to repeated generations #613

Merged
merged 2 commits into from
Jul 21, 2022
Merged

Perf improvements to repeated generations #613

merged 2 commits into from
Jul 21, 2022

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Jul 21, 2022

Toward a couple of the items on the list in #612:

  • Calling PEReaderExtensions.GetMetadataReader is apparently quite slow because of some in-memory buffer copies. We can pool and recycle the result of this call.
  • TryGetEnumName exhaustively searches all enum values in the metadata on every call. On subsequent generations, we should be able to reuse the result of this search rather than repeating it.

This was seen to be one of the largest single contributors to CPU time in a customer trace.
It turns out `PEReaderExtensions.GetMetadataReader` took 1.6 seconds in a customer trace where the source generator was invoked many times. We can certainly optimize this by pooling the result of this call.
@AArnott AArnott added the enhancement New feature or request label Jul 21, 2022
@AArnott AArnott enabled auto-merge July 21, 2022 19:02
@AArnott AArnott merged commit 16294a2 into main Jul 21, 2022
@AArnott AArnott deleted the perfwork branch July 21, 2022 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant