File tree Expand file tree Collapse file tree 4 files changed +29
-66
lines changed Expand file tree Collapse file tree 4 files changed +29
-66
lines changed Original file line number Diff line number Diff line change @@ -29,5 +29,5 @@ tinyjson = "2.5.1"
29
29
30
30
# Solution dependencies
31
31
itertools = " 0.13.0"
32
- pariter = " 0.5.1 "
32
+ rayon = " 1.10.0 "
33
33
regex = " 1.11.1"
Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
27
27
| [ Day 3] ( ./src/bin/03.rs ) | ` 561.0µs ` | ` 565.5µs ` |
28
28
| [ Day 4] ( ./src/bin/04.rs ) | ` 560.8µs ` | ` 161.9µs ` |
29
29
| [ Day 5] ( ./src/bin/05.rs ) | ` 344.6µs ` | ` 323.6µs ` |
30
- | [ Day 6] ( ./src/bin/06.rs ) | ` 499.6µs ` | ` 160.3ms ` |
30
+ | [ Day 6] ( ./src/bin/06.rs ) | ` 492.2µs ` | ` 118.9ms ` |
31
31
32
- ** Total: 164.11ms **
32
+ ** Total: 122.70ms **
33
33
<!-- - benchmarking table --->
34
34
35
35
---
Original file line number Diff line number Diff line change
1
+ use rayon:: iter:: ParallelIterator ;
1
2
use std:: collections:: HashSet ;
2
3
use itertools:: Itertools ;
3
- use pariter :: { scope , IteratorExt } ;
4
+ use rayon :: prelude :: IntoParallelRefIterator ;
4
5
5
6
advent_of_code:: solution!( 6 ) ;
6
7
@@ -112,8 +113,8 @@ pub fn part_two(input: &str) -> Option<u32> {
112
113
map. predict_path ( ) ;
113
114
let mut original_path = map. visited_pos ;
114
115
original_path. remove ( & map. starting_pos ) ;
115
- Some ( scope ( |scope| original_path. iter ( )
116
- . parallel_filter_scoped ( scope , move |pos| {
116
+ Some ( original_path. par_iter ( )
117
+ . filter ( |pos| {
117
118
let mut new_obstacles = map. obstacles . clone ( ) ;
118
119
new_obstacles. insert ( * * pos) ;
119
120
let mut map = Map {
@@ -123,7 +124,7 @@ pub fn part_two(input: &str) -> Option<u32> {
123
124
} ;
124
125
map. has_loop ( )
125
126
} )
126
- . count ( ) as u32 ) . unwrap ( ) )
127
+ . count ( ) as u32 )
127
128
}
128
129
129
130
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments