Restructure wyhash_test.cc to separate golden values
authorBenjamin Barenblat <bbaren@google.com>
Fri, 27 May 2022 20:58:38 +0000 (21:58 +0100)
committerBenjamin Barenblat <bbaren@debian.org>
Fri, 27 May 2022 20:58:38 +0000 (21:58 +0100)
commit4f7c8a6e0336f4c629ad284586be454adcc12937
tree7c2640aadedb69d71213add6fd02a005c33bac0a
parent6462f6356a7831190135ffce218a04a0d14bd4c6
Restructure wyhash_test.cc to separate golden values

Forwarded: yes
Origin: backport, https://github.com/abseil/abseil-cpp/commit/a05366d851c5cb88065272f951e03955197e7c11

This patch is a subset of the referenced commit, which originally also changed
the mix function on arm64. The original message is as follows:

    Alternative bit mixer for LowLevelHash on ARM

    LowLevelHash's bit-mixer is inefficient on ARM because it calculates
    a 128-bit product of two 64-bit numbers. On ARM, this requires a
    sequence of two instructions with a high combined latency and poor
    throughput. This change provides alternative bit-mixing code for ARM
    that uses only 64-bit arithmetic (multiplication, xor, and
    left-shifts) and speeds things up considerably.

    The bit-mixing code for ARM was inspired by by Woothash[1] and
    xxh3[1]. Once I landed on a sequence of operations that provided
    good mixing, I used a test harness to search for the combination of
    shift / rotate factors that provided the best mixing, as indicated
    by SMHasher hash quality tests. The new mixing code passes 13 out of
    15 of the hash quality test suites in SMHasher, with the two
    failures being in the noise range: e.g. 1 collision vs. zero
    expected in a keyset of ~8m keys.

          [1]: https://github.com/tommyettinger/waterhash/blob/49f5cf0b63b9/woothash.h#L16-L20
          [2]: https://github.com/Cyan4973/xxHash/blob/6853ddc36e46/xxhash.h#L3240-L3265

    PiperOrigin-RevId: 391833008

This restructuring is a prerequisite for big-endian-hash2.diff.

Gbp-Pq: Name big-endian-hash.diff
absl/hash/internal/wyhash_test.cc