perf(transformer): create Vec with capacity (#3613)

Tiny optimization. Where we know the required capacity of a `Vec`, initialize it with that capacity.
This commit is contained in:
overlookmotel 2024-06-11 06:41:15 +00:00
parent 0fb4c35083
commit f4c1389e99

View file

@ -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));