diff options
| author | Björn Steinbrink <bsteinbr@gmail.com> | 2015-05-03 14:02:25 +0200 |
|---|---|---|
| committer | Björn Steinbrink <bsteinbr@gmail.com> | 2015-05-03 14:08:30 +0200 |
| commit | f4176b52d3817b93570a73e2768736276d76ebf5 (patch) | |
| tree | 5a8603ba1ca1daa77203d10f42522dc26a8eb6a2 /src/libstd/collections | |
| parent | 0d7d3ec9d2b314af0188a820c58fbd95ee905793 (diff) | |
| download | rust-f4176b52d3817b93570a73e2768736276d76ebf5.tar.gz rust-f4176b52d3817b93570a73e2768736276d76ebf5.zip | |
Restore HashMap performance by allowing some functions to be inlined
Since the hashmap and its hasher are implemented in different crates, we currently can't benefit from inlining, which means that especially for small, fixed size keys, there is a huge overhead in hash calculations, because the compiler can't apply optimizations that only apply for these keys. Fixes the brainfuck benchmark in #24014.
Diffstat (limited to 'src/libstd/collections')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ec130e8233a..f82c1653be1 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1600,6 +1600,7 @@ impl RandomState { reason = "hashing an hash maps may be altered")] impl HashState for RandomState { type Hasher = SipHasher; + #[inline] fn hasher(&self) -> SipHasher { SipHasher::new_with_keys(self.k0, self.k1) } |
