perf(parser): Vec::with_capacity for great improvements
Also played around with SmallVec, it is actually perfoming worse in most cases, and "equal" at best. Signed-off-by: Charlotte Meyer <dev@buffet.sh>
This commit is contained in:
parent
cfd15122ab
commit
009947fa29
1 changed files with 1 additions and 1 deletions
|
@ -29,7 +29,7 @@ impl<'a> From<&'a str> for ParseTree {
|
|||
}
|
||||
|
||||
fn build_tree(parser: &mut Parser) -> Vec<ParseTree> {
|
||||
let mut children = vec![];
|
||||
let mut children = Vec::with_capacity(4);
|
||||
|
||||
while let Some(ev) = parser.next() {
|
||||
match ev {
|
||||
|
|
Loading…
Reference in a new issue