Shrink NamedMatchVec to one inline element.

This counters the `NamedMatchVec` size increase from the previous
commit, leaving `NamedMatchVec` smaller than before.
This commit is contained in:
Nicholas Nethercote 2022-03-23 13:09:55 +11:00
parent 6817442ec7
commit cad5f1e774

View File

@ -101,11 +101,14 @@ struct MatcherTtFrame<'tt> {
idx: usize,
}
type NamedMatchVec = SmallVec<[NamedMatch; 4]>;
// One element is enough to cover 95-99% of vectors for most benchmarks. Also,
// vectors longer than one frequently have many elements, not just two or
// three.
type NamedMatchVec = SmallVec<[NamedMatch; 1]>;
// This type is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(NamedMatchVec, 168);
rustc_data_structures::static_assert_size!(NamedMatchVec, 48);
/// Represents a single "position" (aka "matcher position", aka "item"), as
/// described in the module documentation.