[all-commits] [llvm/llvm-project] fb17bb: [DenseMap] Update combineHashValue

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Jun 19 10:30:35 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fb17bbce80cf76ce1a31eff463f451f626bc36b5
      https://github.com/llvm/llvm-project/commit/fb17bbce80cf76ce1a31eff463f451f626bc36b5
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-06-19 (Wed, 19 Jun 2024)

  Changed paths:
    M llvm/include/llvm/ADT/DenseMapInfo.h

  Log Message:
  -----------
  [DenseMap] Update combineHashValue

`combineHashValue` is a custom bit mixer from 2008
(5fc8ab6d187aefbf1d2cbd36e191e675b14db8f6) used for std::pair and
std::tuple. It has a long dependency chain and slow. Replace it with
a simply multiply-xorshift style hash using a constant from
splitmix64[1]. abseil-cpp and carbon also use this style, but with
uint128 to probably get a lower avalanche bias. We don't use uint128 for
MSVC portability.

Measured time to compute [0,1000000000) values on an i7-11850H:

* old: 1.163s
* new: 0.427s

[1]: https://jonkagstrom.com/tuning-bit-mixers/index.html

Pull Request: https://github.com/llvm/llvm-project/pull/95970



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list