From 4a4315bf4bbd8559020689ff6e99d44004c8adb8 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Sun, 31 May 2015 11:03:46 +0300 Subject: [PATCH] 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). --- src/libstd/collections/hash/table.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 4841f36c7f747..2616bc5278589 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)