[llvm-commits] [PATCH] Make Inits FoldingSetNodes

Chris Lattner clattner at apple.com
Fri Jul 15 13:18:13 PDT 2011


On Jul 15, 2011, at 9:13 AM, David A. Greene wrote:
> Chris Lattner <clattner at apple.com> writes:
>>> Question on these three.  DenseMap of what?  There's an opcode, multiple
>>> operands and a type.  What's the Key, a struct of these items?  Is a
>>> DenseMap much more efficient than a FoldingSetNode when string
>>> comparison/hash is involved?  Wouldn't hashing a struct of these and
>>> putting them in a DenseMap basically be equivalent to a FoldingSet?
>> 
>> FoldingSet is only efficient for very large and heterogenous objects.
>> Its constant factor is really very very high, so densemap is almost
>> always a win for something with a few elements.
> 
> Ok, good to know.  Would you recommend creating some kind of hash of
> these elements and using that to index a DenseMap?

I'd just use a simple local struct, or std::pair<std::pair if that's the simple thing to do,

-Chris



More information about the llvm-commits mailing list