Skip to content

Commit

Permalink
perf(transformer): create Vec with capacity (#3613)
Browse files Browse the repository at this point in the history
Tiny optimization. Where we know the required capacity of a `Vec`, initialize it with that capacity.
  • Loading branch information
overlookmotel committed Jun 11, 2024
1 parent 0fb4c35 commit f4c1389
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/react/jsx_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl<'a> ReactJsxSource<'a> {
self.ctx.ast.object_property(SPAN, kind, key, value, None, false, false, false)
};

let mut properties = self.ctx.ast.new_vec();
let mut properties = self.ctx.ast.new_vec_with_capacity(3);
properties.push(ObjectPropertyKind::ObjectProperty(filename));
properties.push(ObjectPropertyKind::ObjectProperty(line_number));
properties.push(ObjectPropertyKind::ObjectProperty(column_number));
Expand Down

0 comments on commit f4c1389

Please sign in to comment.