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