mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Make ParseVec bigger.
MozReview-Commit-ID: DszMC031Xlj
This commit is contained in:
parent
852efb825f
commit
e8a56e969f
1 changed files with 5 additions and 9 deletions
|
@ -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.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue