README.md
1# rustc-hash
2
3A speedy hash algorithm used within rustc. The hashmap in liballoc by
4default uses SipHash which isn't quite as speedy as we want. In the
5compiler we're not really worried about DOS attempts, so we use a fast
6non-cryptographic hash.
7
8This is the same as the algorithm used by Firefox -- which is a
9homespun one not based on any widely-known algorithm -- though
10modified to produce 64-bit hash values instead of 32-bit hash
11values. It consistently out-performs an FNV-based hash within rustc
12itself -- the collision rate is similar or slightly worse than FNV,
13but the speed of the hash function itself is much higher because it
14works on up to 8 bytes at a time.
15
16## Usage
17
18```
19use rustc_hash::FxHashMap;
20let map: FxHashMap<u32, u32> = FxHashMap::default();
21```
22