julia
a970e16c - `Integer` can be hashed rapidly as well (#58440)

Commit
328 days ago
`Integer` can be hashed rapidly as well (#58440) as noted in https://github.com/JuliaLang/julia/pull/58388#discussion_r2085241015 , using `hash_bytes` for `BigInt` limbs in isolation will break some hashing invariants. accordingly this PR updates also the `hash_integer` fallback to use rapidhash some surgery was needed to make `BigFloat` and `Rational` and such still match, but I think (hope?) I got it all below are some benchmarks. the `y` axis is nanoseconds and the `x` axis is an input of size `1234^x`, so `length = 10` means input `hash(big(1234^10))` hashing `BigFloat` got a small bit slower, but this already allocates and already seems less common than hashing `BigInt` (whose hashing remains non-allocating) ![image](https://github.com/user-attachments/assets/df6de62d-5c8e-4779-b5fc-67143f868572) ![image](https://github.com/user-attachments/assets/5c7201b2-78a4-4e80-bee6-989fd29cfc86)
Author
Parents
Loading