Skip to content

Commit 0e391ab

Browse files
committed
Day 16
1 parent b0e35fc commit 0e391ab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/bin/16.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ pub fn part_two(input: &str) -> Option<u64> {
103103
cost: u64,
104104
}
105105

106-
let path_pool = Pool::new(32, || Vec::with_capacity(1024));
107-
let mut path = path_pool.pull(|| Vec::with_capacity(1024));
106+
const PATH_CAPACITY: usize = 256;
107+
let path_pool = Pool::new(256, || Vec::with_capacity(PATH_CAPACITY));
108+
let mut path = path_pool.pull(|| Vec::with_capacity(PATH_CAPACITY));
108109
path.push(start);
109110

110111
let mut q = VecDeque::new();
@@ -189,7 +190,7 @@ pub fn part_two(input: &str) -> Option<u64> {
189190
}
190191

191192
let (pos, dir, cost) = all_options[idx];
192-
let mut new_path = path_pool.pull(|| Vec::with_capacity(1024));
193+
let mut new_path = path_pool.pull(|| Vec::with_capacity(PATH_CAPACITY));
193194
new_path.clear();
194195
new_path.extend(s.path.iter());
195196
new_path.push(pos);

0 commit comments

Comments
 (0)