about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/stack.rs
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-06-05 12:02:04 -0700
committerJosh Triplett <josh@joshtriplett.org>2025-06-05 12:09:00 -0700
commit43ee7cd57c1706b949c92d6b29a7034b40dff533 (patch)
treeed26d3382bcccee7712b4deb6f0f9b5d77163133 /compiler/rustc_data_structures/src/stack.rs
parentdf8102fe5f24f28a918660b0cd918d7331c3896e (diff)
downloadrust-43ee7cd57c1706b949c92d6b29a7034b40dff533.tar.gz
rust-43ee7cd57c1706b949c92d6b29a7034b40dff533.zip
Simplify and optimize `SlotIndex::from_index`
Break out bucket 0 (containing `idx < 4096`) as an early return, which
simplifies the remainder of the function, and allows optimizing the
`checked_ilog2` since it can no longer return `None`.

This reduces the runtime of `vec_cache::tests::slot_index_exhaustive`
(which calls `SlotIndex::from_index` for every `u32`, twice) from ~15.5s
to ~13.3s.
Diffstat (limited to 'compiler/rustc_data_structures/src/stack.rs')
0 files changed, 0 insertions, 0 deletions