Skip to content

Commit

Permalink
Auto merge of #110410 - saethlin:hash-u128-as-u64s, r=oli-obk
Browse files Browse the repository at this point in the history
Implement StableHasher::write_u128 via write_u64

In rust-lang/rust#110367 (comment) the cachegrind diffs indicate that nearly all the regression is from this:
```
22,892,558  ???:<rustc_data_structures::sip128::SipHasher128>::slice_write_process_buffer
-9,502,262  ???:<rustc_data_structures::sip128::SipHasher128>::short_write_process_buffer::<8>
```
Which happens because the diff for that perf run swaps a `Hash::hash` of a `u64` to a `u128`. But `slice_write_process_buffer` is a `#[cold]` function, and is for handling hashes of arbitrary-length byte arrays.

Using the much more optimizer-friendly `u64` path twice to hash a `u128` provides a nice perf boost in some benchmarks.
  • Loading branch information
bors committed Apr 18, 2023
2 parents 78001a1 + 5b8f1d4 commit db71835
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit db71835

Please sign in to comment.