Skip to content

Commit 4a4315b

Browse files
committed
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 rust-lang#25916).
1 parent 78c4d53 commit 4a4315b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libstd/collections/hash/table.rs

+1
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ fn test_rounding() {
528528

529529
// Returns a tuple of (key_offset, val_offset),
530530
// from the start of a mallocated array.
531+
#[inline]
531532
fn calculate_offsets(hashes_size: usize,
532533
keys_size: usize, keys_align: usize,
533534
vals_align: usize)

0 commit comments

Comments
 (0)