tag | ba815c7797062723fc37c5068029180ba9167251 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon Sep 21 17:00:12 2020 -0700 |
object | 2bcd0bc46a14feabf4b0e42cfba7238bc9e8a889 |
Platform Tools Release 30.0.4 (6686687)
commit | 2bcd0bc46a14feabf4b0e42cfba7238bc9e8a889 | [log] [tgz] |
---|---|---|
author | android-build-prod (mdb) <android-build-team-robot@google.com> | Thu Jul 16 21:24:12 2020 +0000 |
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | Thu Jul 16 21:24:12 2020 +0000 |
tree | d52fbb380bbf761e3e0b9a70e39d984523d2a781 | |
parent | 2d6ed856db7ca81d612d0240f4fd12021fcfd164 [diff] | |
parent | c908ce8b83135d5f8727b016d7bb14dc697e7b9e [diff] |
Snap for 6686656 from c908ce8b83135d5f8727b016d7bb14dc697e7b9e to sdk-release Change-Id: I8b7cab4b1fd2003a3ec8ca0902d6abd7239e8720
A speedy hash algorithm used within rustc. The hashmap in liballoc by default uses SipHash which isn‘t quite as speedy as we want. In the compiler we’re not really worried about DOS attempts, so we use a fast non-cryptographic hash.
This is the same as the algorithm used by Firefox -- which is a homespun one not based on any widely-known algorithm -- though modified to produce 64-bit hash values instead of 32-bit hash values. It consistently out-performs an FNV-based hash within rustc itself -- the collision rate is similar or slightly worse than FNV, but the speed of the hash function itself is much higher because it works on up to 8 bytes at a time.
use rustc_hash::FxHashMap; let mut map: FxHashMap<u32, u32> = FxHashMap::default(); map.insert(22, 44);
no_std
This crate can be used as a no_std
crate by disabling the std
feature, which is on by default, as follows:
rustc-hash = { version = "1.0", default-features = false }
In this configuration, FxHasher
is the only export, and the FxHashMap
/FxHashSet
type aliases are omitted.