diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 761ec8918..8caf76cac 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -314,24 +314,17 @@ struct template constexpr auto impl (const T& v, hb_priority<2>) const HB_RETURN (uint32_t, hb_deref (v).hash ()) -#if 0 - // The following, unfortunately, while keeps the probing chains short, slows - // down the overall hash table performance. Not because of the extra operation - // itself in my opinion, but something else going on that we have not been able - // to track down. So for now, this is disabled. Discuss: - // https://github.com/harfbuzz/harfbuzz/pull/4228 - // Horrible: std:hash() of integers seems to be identity in gcc / clang?! // https://github.com/harfbuzz/harfbuzz/pull/4228 - + // + // For performance characteristics see: + // https://github.com/harfbuzz/harfbuzz/pull/4228#issuecomment-1565079537 template ::value && sizeof (T) <= sizeof (uint32_t))> constexpr auto impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, v * 2654435761 /* Knuh's multiplicative hash */) - template ::value && sizeof (T) > sizeof (uint32_t))> constexpr auto impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, (v ^ (v >> 32)) * 2654435761 /* Knuth's multiplicative hash */) -#endif template constexpr auto impl (const T& v, hb_priority<0>) const HB_RETURN (uint32_t, std::hash>{} (hb_deref (v)))