MCPcopy Create free account
hub / github.com/NthTensor/Forte / throughput_forte

Function throughput_forte

benches/fork_join.rs:94–110  ·  view source on GitHub ↗
(bencher: Bencher, nodes: (usize, usize))

Source from the content-addressed store, hash-verified

92
93#[divan::bench(args = nodes())]
94fn throughput_forte(bencher: Bencher, nodes: (usize, usize)) {
95 fn sum(node: &Node, worker: &Worker) -> u64 {
96 let (left, right) = worker.join(
97 |w| node.left.as_deref().map(|n| sum(n, w)).unwrap_or_default(),
98 |w| node.right.as_deref().map(|n| sum(n, w)).unwrap_or_default(),
99 );
100
101 node.val + left + right
102 }
103
104 bencher.bench(|| {
105 COMPUTE.with_worker(|worker| {
106 let tree = Node::tree(nodes.0);
107 assert_eq!(sum(&tree, worker), nodes.1 as u64);
108 });
109 });
110}
111
112#[divan::bench(args = nodes())]
113fn chili(bencher: Bencher, nodes: (usize, usize)) {

Callers

nothing calls this directly

Calls 1

with_workerMethod · 0.80

Tested by

no test coverage detected