Make ParseVec bigger.

MozReview-Commit-ID: DszMC031Xlj
This commit is contained in:
Bobby Holley 2017-06-02 20:02:10 -07:00
parent 852efb825f
commit e8a56e969f

View file

@ -932,15 +932,11 @@ fn parse_selector<P, Impl>(parser: &P, input: &mut CssParser) -> Result<Selector
Ok(selector) Ok(selector)
} }
/// We use a SmallVec for parsing to avoid extra reallocs compared to using a Vec /// We make this large because the result of parsing a selector is fed into a new
/// directly. When parsing is done, we convert the SmallVec into a Vec (which is /// Arc-ed allocation, so any spilled vec would be a wasted allocation. Also,
/// free if the vec has already spilled to the heap, and more cache-friendly if /// Components are large enough that we don't have much cache locality benefit
/// it hasn't), and then steal the buffer of that vec into a boxed slice. /// from reserving stack space for fewer of them.
/// type ParseVec<Impl> = SmallVec<[Component<Impl>; 32]>;
/// If we parse N <= 4 entries, we save no reallocations.
/// If we parse 4 < N <= 8 entries, we save one reallocation.
/// If we parse N > 8 entries, we save two reallocations.
type ParseVec<Impl> = SmallVec<[Component<Impl>; 8]>;
/// Parses a complex selector, including any pseudo-element. /// Parses a complex selector, including any pseudo-element.
/// ///