create some vectors with initial capacities (#3701)

Signed-off-by: Benjamin Coenen <benjamin.coenen@hotmail.com>
This commit is contained in:
Coenen Benjamin
2019-09-27 11:46:53 +02:00
committed by Bastian Köcher
parent 62be947877
commit 53a43e92aa
3 changed files with 17 additions and 19 deletions
+2 -2
View File
@@ -61,8 +61,7 @@ fn do_phragmen(
// prefix to distinguish the validator and nominator account ranges.
let np = 10_000;
let mut candidates = vec![];
let mut voters = vec![];
let mut candidates = Vec::with_capacity(num_vals as usize);
let mut slashable_balance_of: BTreeMap<AccountId, Balance> = BTreeMap::new();
(1 ..= num_vals)
@@ -71,6 +70,7 @@ fn do_phragmen(
slashable_balance_of.insert(acc, STAKE + rr(10, 50));
});
let mut voters = Vec::with_capacity(num_noms as usize);
(np ..= (np + num_noms))
.for_each(|acc| {
let mut stashes_to_vote = candidates.clone();