Auto merge of #3019 - ttsugriy:ttsugriy-patch-1-1, r=RalfJung
[perf] Reserve capacity for argvs. This avoids unnecessary allocations to grow vector to sufficient size.
This commit is contained in:
commit
4b2ec291ea
@ -301,7 +301,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
|
||||
// Third argument (`argv`): created from `config.args`.
|
||||
let argv = {
|
||||
// Put each argument in memory, collect pointers.
|
||||
let mut argvs = Vec::<Immediate<Provenance>>::new();
|
||||
let mut argvs = Vec::<Immediate<Provenance>>::with_capacity(config.args.len());
|
||||
for arg in config.args.iter() {
|
||||
// Make space for `0` terminator.
|
||||
let size = u64::try_from(arg.len()).unwrap().checked_add(1).unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user