MCPcopy Create free account
hub / github.com/dpc/pariter / map_vs_map_parallel

Function map_vs_map_parallel

src/tests.rs:7–19  ·  view source on GitHub ↗
(v: Vec<usize>, threads: usize, max_in_flight: usize)

Source from the content-addressed store, hash-verified

5
6#[quickcheck]
7fn map_vs_map_parallel(v: Vec<usize>, threads: usize, max_in_flight: usize) -> bool {
8 let m: Vec<_> = v.clone().into_iter().map(|x| x / 2).collect();
9 let mp: Vec<_> = v
10 .clone()
11 .into_iter()
12 .parallel_map_custom(
13 |o| o.threads(threads % 32).buffer_size(max_in_flight % 128),
14 |x| x / 2,
15 )
16 .collect();
17
18 m == mp
19}
20
21#[quickcheck]
22fn map_vs_map_parallel_double(v: Vec<usize>, threads: usize, max_in_flight: usize) -> bool {

Callers

nothing calls this directly

Calls 3

parallel_map_customMethod · 0.80
buffer_sizeMethod · 0.45
threadsMethod · 0.45

Tested by

no test coverage detected