-
Notifications
You must be signed in to change notification settings - Fork 127
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
Use LinkContext caching when resolving ExportedTypes #3075
Conversation
@@ -10,6 +10,7 @@ namespace Mono.Linker | |||
{ | |||
public static class MethodReferenceExtensions | |||
{ | |||
[System.Diagnostics.CodeAnalysis.SuppressMessage ("ApiDesign", "RS0030:Do not used banned APIs", Justification = "MethodReference.Resolve is banned for performance reasons. GetDisplayName should be a really cold path and shouldn't require a context to call.")] |
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.
- Please use pragma
- Would it be too ugly to pass the context to GetDisplayName?
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.
It might not necessarily be ugly, but I think it would take significant effort to bubble up the context parameter to GetDisplayName on all the SingleValue types and TypeSystemProxy types, and it's really only called from diagnostics which should be a very cold path anyway.
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.
LGTM, thank you!
) Commit migrated from dotnet/linker@add4655
) Commit migrated from dotnet/linker@add4655
When profiling ASP.Net benchmark builds, I found significant time was being spent resolving
ExportedType
's since we don't have a cache for those like we do for TypeReference and MethodReference.
Bans MethodReference.Resolve and ExportedType.Resolve and recommend LinkContext.Resolve instead (except in SweepStep).
Adds a cache on LinkContext for resolving ExportedTypes and replaces calls to Cecil's Resolve.
Replaces some calls to MethodReference.Resolve.
Together with #3073, performance improves to better than before the virtual method regression in August.
Trimmer CPU milliseconds on ASP.Net benchmarks build:
27325 before the regression related to #3067
87310 in main
23520 after #3073 + this change