On Tue, Jul 16, 2013 at 06:46:22PM +0800, ZhengLingyun wrote:
> As you have said in hindex.h, hindex need a high-quality hash function to
> work appropriately. So maybe these two kinds of hindex_head_node() are
> similar in performance.

No.  The quality of the hash function ensures that each bucket has a
small number of head nodes.  It does not do anything to reduce the
number of body nodes.  If there is no expectation of duplicates, then
the client would use hmap instead, since it uses less time and space.

> If unfortunately hindex meets a low-quality hash function, i think it will
> depands on the hash function, which will more likely to produce the same
> hash result, like constant_hash(), or will more likely to produce different 
> hash
> but AND a MASK will produce a same result, like
> hash = (good_hash(value) << 16 | constant_hash() & 0xFFFF).

This is not about the number of hash collisions.

> Maybe we can just use hindex_node_with_hash() instead of hindex_head_node(),
> these two functions seems confusing.

I considered that but there may be a benefit to avoiding an extra test
in the inner loop.  (If you have better names to suggest for these
functions, then I'm willing to change them.)

I applied this to master.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to