• Xiao Shi's avatar
    implement `commutative_hash_combine_*` for unordered containers · e06814f9
    Xiao Shi authored
    Summary:
    `hash_range(c.begin(), c.end()` combines hashes of individual elements of a
    container in an ordered manner. This diff provides the equivalent for
    unordered containers.
    
    Unlike `hash_range`, `commutative_hash_combine_range` defaults to `folly::Hash`
    as its hasher; it mixes the individual hash if the `hasher` is not deemed
    avalanching.
    
    It uses a commutative accumulator described in this paper:
    https://www.preprints.org/manuscript/201710.0192/v1/download
    In the experiments in the paper, the symmetric polynomial yielded a better
    spread of hash values and lower collision rates than `+` or `xor`.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D9688687
    
    fbshipit-source-id: c812b25975a53a868d98f78645146cb8bdbb5c32
    e06814f9
HashTest.cpp 27.2 KB