MCPcopy Create free account
hub / github.com/consistent-milk12/masstree / wscale_threads

Function wscale_threads

tests/cpp/wscale.rs:47–70  ·  view source on GitHub ↗
(num_threads: usize)

Source from the content-addressed store, hash-verified

45}
46
47fn wscale_threads(num_threads: usize) {
48 let tree = Arc::new(MassTree15Inline::<u64>::new());
49 let per_thread = N / num_threads;
50
51 let handles: Vec<_> = (0..num_threads)
52 .map(|tid| {
53 let tree = Arc::clone(&tree);
54 thread::spawn(move || {
55 let guard = tree.guard();
56 let mut rng = StdRng::seed_from_u64(SEED + tid as u64);
57
58 for _ in 0..per_thread {
59 let x: u64 = rng.random();
60 let key = x.to_be_bytes();
61 let _ = tree.insert_with_guard(&key, x + 1, &guard);
62 }
63 })
64 })
65 .collect();
66
67 for h in handles {
68 h.join().unwrap();
69 }
70}

Callers 3

wscale_concurrent_2Function · 0.85
wscale_concurrent_4Function · 0.85
wscale_concurrent_6Function · 0.85

Calls 2

guardMethod · 0.80
insert_with_guardMethod · 0.80

Tested by 3

wscale_concurrent_2Function · 0.68
wscale_concurrent_4Function · 0.68
wscale_concurrent_6Function · 0.68