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

Function concurrent_32x50_unique

nodedb/src/control/database/registry.rs:281–297  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

279
280 #[test]
281 fn concurrent_32x50_unique() {
282 let reg = Arc::new(DatabaseRegistry::new());
283 let mut handles = Vec::with_capacity(32);
284 for _ in 0..32 {
285 let r = reg.clone();
286 handles.push(std::thread::spawn(move || {
287 (0..50).map(|_| r.alloc_one().as_u64()).collect::<Vec<_>>()
288 }));
289 }
290 let mut all: Vec<u64> = handles
291 .into_iter()
292 .flat_map(|h| h.join().unwrap())
293 .collect();
294 all.sort();
295 all.dedup();
296 assert_eq!(all.len(), 1600);
297 }
298
299 #[test]
300 fn flush_ops_threshold() {

Callers

nothing calls this directly

Calls 8

collectMethod · 0.80
joinMethod · 0.80
dedupMethod · 0.80
spawnFunction · 0.50
cloneMethod · 0.45
pushMethod · 0.45
as_u64Method · 0.45
alloc_oneMethod · 0.45

Tested by

no test coverage detected