NodeMap<V>
: an interned Map<Node*, V> implementation.
#3118
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.
NodeMap<V>
: an interned Map<Node*, V> implementation.This is a std::map-alike for specifically maps with Node* as keys which holds the mapped value logically interned into the node itself. This is substantially faster than a flat-hash-map in many cases with speedups of up to 10% seen in optimization time on some targets when integrated into a few passes.
This implementation is specifically made so that it can (mostly) function as a drop in replacement for flat_hash_map<Node*, V>. There are some notable differences however:
Any read of the map requires 4 pointer reads (node -> user-data-vector -> map node -> value).
This map is (very slightly) less efficient than flat_hash_map if the value type is trivially copyable. To ensure that this is respected by default the map will have a compile error if you attempt to use it with these sorts of values.