From 8340f2c8facfd0195a9e01b64573d6833ca91def Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Wed, 12 Dec 2018 13:08:35 +0100 Subject: [PATCH] Preallocate correct state length. --- 2018/src/day12.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2018/src/day12.rs b/2018/src/day12.rs index 233d1b0..928eb44 100644 --- a/2018/src/day12.rs +++ b/2018/src/day12.rs @@ -78,7 +78,7 @@ impl Day12 { } fn simulate(&self, state: &State) -> State { - let mut new_state = Vec::new(); + let mut new_state = Vec::with_capacity(state.len() + 8); let mut index = 0; let mut last_idx = None; for &(idx, b) in state {