-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add more prime sizes to HashMap #117108
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
Add more prime sizes to HashMap #117108
Conversation
We have seen cases where the current sizes are not sufficient and end up with pathological behavior.
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.
Pull Request Overview
This PR extends the list of prime numbers used by the hash table to address potential performance issues when the current sizes are insufficient.
- Added additional larger primes to support cases where the hash table may require more buckets.
- Enhanced the available prime range for better distribution in high-load scenarios.
Comments suppressed due to low confidence (1)
src/coreclr/vm/hash.cpp:33
- Consider adding unit tests to verify that the new extended prime list maintains the expected hash table performance under high load scenarios.
4999559, 5999471, 7199369, 8639249, 10367101, 12440521, 14928637, 17914367,
Tagging subscribers to this area: @mangod9 |
is there a specific benchmark this will improve? |
I have cced you on the internal email thread. The 7M limit was hit on .NET 8 by a workload that kept creating marshalled delegates on 50 worker threads and the finalizer thread fell behind cleaning them up. Once the 7M limit was hit, it went downhill even more rapidly due this hashtable behaving pathologically. Marshalled delegates do not use this hashtable in .NET 10 anymore. This change is to avoid pathological behaviors in case there are other scenario that can store more than 7M elements in the runtime hashtables. |
/ba-g test failure without a log |
We have seen cases where the current sizes are not sufficient and end up with pathological behavior.