parallel-hashmap icon indicating copy to clipboard operation
parallel-hashmap copied to clipboard

how can I generate more mix hash seed?

Open stdpain opened this issue 1 year ago • 0 comments

phmap mix is a pretty good rehash function. In a multi-stage aggregation process I want to use different mix values. But I don't know how to generate a proper mix seed.

   template<>
    struct phmap_mix<8>
    {
        // Very fast mixing (similar to Abseil)
        inline size_t operator()(size_t a) const
        {
            static constexpr uint64_t k = 0xde5fb9d2630458e9ULL;
            // static constexpr uint64_t k = 0x7C9D0BF0567102A5ULL; // [greg] my own random prime
            uint64_t h;
            uint64_t l = umul128(a, k, &h);
            return static_cast<size_t>(h + l);
        }
    };

in absl

  static constexpr uint64_t kMul =
      sizeof(size_t) == 4 ? uint64_t{0xcc9e2d51}
                          : uint64_t{0x9ddfea08eb382d69};

stdpain avatar Jul 23 '24 11:07 stdpain