about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2015-05-31 11:03:46 +0300
committerEduard Burtescu <edy.burt@gmail.com>2015-05-31 11:03:46 +0300
commit4a4315bf4bbd8559020689ff6e99d44004c8adb8 (patch)
treeb7b2cde3b45203f1faf3e17530ff03a1965c2187 /src/libstd
parent78c4d53871b3d75b4de5f96cb1f9cdc11648ccc6 (diff)
downloadrust-4a4315bf4bbd8559020689ff6e99d44004c8adb8.tar.gz
rust-4a4315bf4bbd8559020689ff6e99d44004c8adb8.zip
Inline hash_table::calculate_offsets, used by iterators.
The `HashMap` and `HashSet` iterators use `RawTable::first_bucket_raw` which is generic and will get inlined cross-crate.
However, `first_bucket_raw` calls `calculate_offsets` and the call doesn't get inlined, despite being a simple function.
This missing `#[inline]` results in `hash_table::calculate_offsets` showing up at the top of a callgrind profile with 3 million calls (for the testcase in #25916).
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/collections/hash/table.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs
index 4841f36c7f7..2616bc52785 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -528,6 +528,7 @@ fn test_rounding() {
 
 // Returns a tuple of (key_offset, val_offset),
 // from the start of a mallocated array.
+#[inline]
 fn calculate_offsets(hashes_size: usize,
                      keys_size: usize, keys_align: usize,
                      vals_align: usize)