Skip to content

Commit 85315be

Browse files
committed
Auto merge of #142095 - joshtriplett:optimize-veccache, r=SparrowLii
Simplify and optimize `VecCache`'s `SlotIndex::from_index` 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. Separately, simplify the test case as well. (The old and new code passes with the old and new test case.) --- Noticed because `slot_index_exhaustive` stood out as taking unusually long compared to other tests, so I started investigating what it was doing.
2 parents 1ed8934 + e54dd40 commit 85315be

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)