-
Notifications
You must be signed in to change notification settings - Fork 678
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
Remove the need to allocate a Func on each compatibility cache lookup #4095
Conversation
Using OrchardCore as the solution, this fix eliminates the following allocations:
|
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.
🔪 those allocations.
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.
🚀
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.
Could you please summarize the allocation impact of this fix for Solution Load in OrchardCore?
@aortiz-msft: The allocations in this table quantify the impact this had when doing a restore for OrchardCore. Based on this profile, it's about 42MB of allocations that are no longer being made with this fix! 😄 I plan on pulling data on the impact of each of my fixes on Solution Load with OrchardCore once this series of PRs have been merged. |
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.
6d2df22
to
3d7b143
Compare
Bug
Fixes: NuGet/Home#10919
Regression? Last working version: N/A
Description
Instead of allocating a func to pass to the GetOrAdd method of the concurrent dictionary on each lookup, check the dictionary first to see if the entry already exists and evaluate its compatibility and add it to the cache only if it does not. That way, a Func does not need to be allocated for each lookup and reduces the overall GC pressure.
PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Code is covered by existing tests
Documentation