1. 8

  2. 2

    I’m behind the times, still using FNV in my projects … didn’t realize it’s such a tortoise!

    I wonder if there’s a comparable implementation in C/C++? (I know I could use FFI to call ahash from those languages, but that would mean adding a Rust compiler to our tool chain, which the build team would probably frown on.)

    1. 2

      FFI would also add some overhead, unless you can manage cross-language LTO (I think I’ve succeeded doing that for C, following these instructions: https://matklad.github.io/2020/10/03/fast-thread-locals-in-rust.html.)

    2. 1

      Another nice thing about ahash is that unlike the built-in default hash function in Rust, you can explicitly seed its randomness, which is useful for reproducible benchmarking with e.g. Cachegrind.

      1. 1

        This is impressive enough, that I’ll consider switching in my toy project (an IRC bot that is storing lots of data in a hashset for deduplication). Coming to think of it, the raspberry pi it’s running on probably doesn’t have hardware support for AES-NI though..

        1. 1

          When I switched I saw performance improvements even when I compiled without AES (on x86_64, though, so may differ for you).