Use SHash as DAC instance hash#125631
Merged
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the std::unordered_map-based hash table in DacInstanceManager with an SHash-based implementation by removing the #define DAC_HASHTABLE that previously selected the hand-rolled hash table, activating the #else branch which now uses SHash instead of std::unordered_map. This yields a ~9.5x speedup for minidump collection on deep-stack scenarios.
Changes:
- Remove
#define DAC_HASHTABLEand thestd::unordered_map/std::hash_comparebased implementation, replacing it withSHash<DacInstanceSHashTraits> - Update all hash table operations (
Add,Find,Supersede,Flush,ClearEnumMemMarker,DumpAllInstances) to useSHashAPIs (LookupPtr,ReplacePtr,Remove,RemoveAll,Begin/End)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/debug/daccess/dacimpl.h | Replace std::unordered_map types with SHash<DacInstanceSHashTraits> and custom traits class |
| src/coreclr/debug/daccess/daccess.cpp | Update all hash operations to SHash API calls |
You can also share your feedback on Copilot code review. Take the survey.
This was referenced Mar 17, 2026
Member
Author
|
/ba-g iOS failures are deadletters. |
noahfalk
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the hand-rolled hash table implementation in DacInstanceManager withan
SHashbased implementation. This hash is more efficient for the high volume of find operations the DAC issues when verifying cached cross-process reads. During mini dump collection, DacInstanceManager is the central cache for all memory read from the target process. The hand-rolled hash table used a fixed bucket array that degraded quickly for Find and insertion operations.Measured minidump collection against a repro app with 2.5k frame deep stacks over 50 threads and the speedup was roughly 9.5x.