Bug: 319233932

Clone this repo:
  1. 01df628 run cargo_embargo am: e75869baa9 by Frederick Mayle · 3 months ago main
  2. e75869b run cargo_embargo by Frederick Mayle · 3 months ago simpleperf-release
  3. ce11410 Merge remote-tracking branch 'origin/upstream' am: 7ce0330075 by Inna Palant · 3 months ago
  4. 7ce0330 Merge remote-tracking branch 'origin/upstream' Import b/319233932 by Inna Palant · 3 months ago
  5. eef9a2e Import 'twox-hash' crate by Frederick Mayle · 4 months ago upstream

TwoX-Hash

A Rust implementation of the XXHash algorithm.

Build Status Current Version

Documentation

Examples

With a fixed seed

use std::hash::BuildHasherDefault;
use std::collections::HashMap;
use twox_hash::XxHash64;

let mut hash: HashMap<_, _, BuildHasherDefault<XxHash64>> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

With a random seed

use std::collections::HashMap;
use twox_hash::RandomXxHashBuilder64;

let mut hash: HashMap<_, _, RandomXxHashBuilder64> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

Benchmarks

64-bit

BytesSipHasher (MB/s)XXHash (MB/s)Ratio
1523873%
421014870%
16615615100%
329141391152%
12813473657271%
25614145019355%
51215466168399%
102415656206397%
104857615927564475%
BytesFnvHasher (MB/s)XXHash (MB/s)Ratio
11000384%
480014819%
1676161581%
327611391183%
1287273657503%
2567595019661%
5127456168828%
10247416206838%
104857674575641015%

32-bit

BytesSipHasher (MB/s)XXHash32 (MB/s)Ratio
15255106%
4210210100%
166151230200%
329141882206%
12813473282244%
25614143459245%
51215463792245%
102415653938252%
104857615924127259%
BytesFnvHasher (MB/s)XXHash32 (MB/s)Ratio
11000556%
480021026%
167611230162%
327611882247%
1287273282451%
2567593459456%
5127453792509%
10247413938531%
10485767454127554%

Contributing

  1. Fork it ( https://github.com/shepmaster/twox-hash/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add a failing test.
  4. Add code to pass the test.
  5. Commit your changes (git commit -am 'Add some feature')
  6. Ensure tests pass.
  7. Push to the branch (git push origin my-new-feature)
  8. Create a new Pull Request