MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / parallel_reduce_edge_count

Function parallel_reduce_edge_count

nodedb/src/engine/graph/olap/parallel.rs:262–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

260
261 #[test]
262 fn parallel_reduce_edge_count() {
263 let snap = make_snapshot();
264 let config = ParallelConfig {
265 num_threads: 4,
266 min_partition_size: 10,
267 };
268
269 let total_edges: usize = parallel_reduce(
270 &snap,
271 &config,
272 |range, s| {
273 let mut count = 0;
274 for node in range.start..range.end {
275 count += s.out_degree_raw(node);
276 }
277 count
278 },
279 |partials| partials.into_iter().sum(),
280 );
281
282 assert_eq!(total_edges, 100);
283 }
284
285 #[test]
286 fn parallel_map_single_thread() {

Callers

nothing calls this directly

Calls 4

make_snapshotFunction · 0.85
parallel_reduceFunction · 0.85
sumMethod · 0.80
out_degree_rawMethod · 0.45

Tested by

no test coverage detected