[llvm-commits] [patch] Add a MapVector class

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Sep 18 11:49:50 PDT 2012


> 1) Don't expose map-style iteration of the keys and values at all.

I will take a look. If I remember correctly there is only one user and
it might be possible to change it to a std::vector<std::pair<Key,
Vaue> > + merge sorting.

> 2) Store vector<pair<const KeyT, ValueT>> as the vector storage, and make
> the densemap not even contain the keys.

...

> #2 is appealing in interesting ways. While slower than a traditional
> DenseMap, it would have none of the traditional limitations. The DenseMap
> could actually be DensMap<unsigned, unsigned> where the key is the hash_code
> converted to an unsigned, and the value is the index. It also provides a
> natural way to support the pair-based value_type interface points. However,
> it would have strictly worse locality than your solution or #1.

This is interesting. We can pass a KeyInfoT that has an identity hash
to avoid hashing twice. I will try this as a plan B.

> -Chandler

Cheers,
Rafael



More information about the llvm-commits mailing list