[PATCH] D40736: [CodeView] Add support for type record content hashing

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 14:02:52 PST 2017


zturner added a comment.

In https://reviews.llvm.org/D40736#945605, @ruiu wrote:

> LGTM
>
> Let's land this so that we can experiment. I still doubt if a noncryptographic tree hash is faster than SHA1, but that can be experimented once this patch is in.


We can't compare tree vs non-tree.  Only tree vs tree and non-tree vs non-tree.  In those scenarios, noncryptographic hash function is always faster than SHA1.

Current algorithm uses non-cryptographic non-tree hash function.  The new code will use cryptographic tree hash function.  So hash computation gets slower (tree is slower than non-tree, cryptographic is slower than non-cryptographic), but the magic is that the work can be off-loaded to the compiler.  The other thing that's easy to lose sight of is that it's not just the speed of computing the hash.  It's also the cost of probing.  Since our hashes are keyed off of only 4 bytes, there's always going to be lots of probes no matter what the hash function is, and in the case of a tree hash we never have to do a full equality comparison, we can just compare the 20 bytes of the hash and that's "good enough".  On a large application, that could be several terabytes of memcmps which we can now eliminate.

Anyway, like you said we'll see after some more experimentation :)  Thanks!


https://reviews.llvm.org/D40736





More information about the llvm-commits mailing list