Skip to content

Commit 66c2395

Browse files
committed
Day 16
1 parent 0e391ab commit 66c2395

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
2626
| [Day 13](./src/bin/13.rs) | `90.9µs` | `91.8µs` |
2727
| [Day 14](./src/bin/14.rs) | `30.8µs` | `3.5ms` |
2828
| [Day 15](./src/bin/15.rs) | `119.7µs` | `591.0µs` |
29-
| [Day 16](./src/bin/16.rs) | `203.4µs` | `33.3ms` |
29+
| [Day 16](./src/bin/16.rs) | `193.4µs` | `22.6ms` |
3030

31-
**Total: 64.83ms**
31+
**Total: 54.12ms**
3232
<!--- benchmarking table --->
3333

3434
---

src/bin/16.rs

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

106-
const PATH_CAPACITY: usize = 256;
106+
const PATH_CAPACITY: usize = 512;
107107
let path_pool = Pool::new(256, || Vec::with_capacity(PATH_CAPACITY));
108108
let mut path = path_pool.pull(|| Vec::with_capacity(PATH_CAPACITY));
109109
path.push(start);
@@ -191,8 +191,7 @@ pub fn part_two(input: &str) -> Option<u64> {
191191

192192
let (pos, dir, cost) = all_options[idx];
193193
let mut new_path = path_pool.pull(|| Vec::with_capacity(PATH_CAPACITY));
194-
new_path.clear();
195-
new_path.extend(s.path.iter());
194+
new_path.clone_from(&s.path);
196195
new_path.push(pos);
197196
let new_state = State {
198197
path: new_path,

0 commit comments

Comments
 (0)