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

Optimization: Memoize RequiredMemberAttribute search #1415

Merged
merged 5 commits into from
Mar 18, 2024

Conversation

SergeiPavlov
Copy link
Contributor

We see in Profiler that .GetCustomAttribute() is a hotspot.
Memoizing it will improve performance.

image

@SergeiPavlov
Copy link
Contributor Author

I see this will not work because of "Unloading feature"
CanLoadInstanceOfAssemblyAndUnloadItAfterOnActivatedInModule test

@tillig
Copy link
Member

tillig commented Mar 18, 2024

We have all of the reflection-related caches centralized to allow for unloading assembly load contexts. I'm guessing that's why some of those tests are failing.

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.52%. Comparing base (b843130) to head (3fe2ddf).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1415      +/-   ##
===========================================
+ Coverage    78.48%   78.52%   +0.03%     
===========================================
  Files          200      200              
  Lines         5703     5713      +10     
  Branches      1168     1168              
===========================================
+ Hits          4476     4486      +10     
  Misses         714      714              
  Partials       513      513              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SergeiPavlov
Copy link
Contributor Author

Thank you.
Refactored to use ReflectionCacheSet

Copy link
Member

@tillig tillig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Will hold on releasing publicly until we figure out #1414, but you can do a comparison using the MyGet feed https://www.myget.org/F/autofac/api/v3/index.json - a -beta should show up there based on the build here.

@tillig tillig merged commit 4547d16 into autofac:develop Mar 18, 2024
3 checks passed
@tillig tillig mentioned this pull request Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants