@@ -2,6 +2,7 @@ use criterion::*;
2
2
use prodash:: {
3
3
messages:: MessageLevel ,
4
4
tree:: { root:: Options as TreeOptions , Root as Tree } ,
5
+ BoxedDynProgress ,
5
6
} ;
6
7
7
8
fn usage ( c : & mut Criterion ) {
@@ -13,15 +14,20 @@ fn usage(c: &mut Criterion) {
13
14
. create ( )
14
15
. into ( )
15
16
}
16
- c. benchmark_group ( "Tree::add_child " )
17
- . throughput ( Throughput :: Elements ( 4 ) )
18
- . bench_function ( "add children to build a tree of tasks and clear them (in drop) " , |b| {
17
+ c. benchmark_group ( "BoxedDynProgress::set " )
18
+ . throughput ( Throughput :: Elements ( 5 ) )
19
+ . bench_function ( "set tree 5 times " , |b| {
19
20
let root = small_tree ( ) ;
21
+ let mut progress = root. add_child ( "the one" ) ;
22
+ progress. init ( Some ( 20 ) , Some ( "element" . into ( ) ) ) ;
23
+ let mut progress = BoxedDynProgress :: new ( progress) ;
24
+ use prodash:: Progress ;
20
25
b. iter ( || {
21
- let mut c = root. add_child ( "1" ) ;
22
- let _one = c. add_child ( "1" ) ;
23
- let _two = c. add_child ( "2" ) ;
24
- let _three = c. add_child ( "3" ) ;
26
+ progress. set ( 1 ) ;
27
+ progress. set ( 2 ) ;
28
+ progress. set ( 3 ) ;
29
+ progress. set ( 4 ) ;
30
+ progress. set ( 5 ) ;
25
31
} ) ;
26
32
} ) ;
27
33
c. benchmark_group ( "tree::Item::set" )
@@ -38,6 +44,17 @@ fn usage(c: &mut Criterion) {
38
44
progress. set ( 5 ) ;
39
45
} ) ;
40
46
} ) ;
47
+ c. benchmark_group ( "Tree::add_child" )
48
+ . throughput ( Throughput :: Elements ( 4 ) )
49
+ . bench_function ( "add children to build a tree of tasks and clear them (in drop)" , |b| {
50
+ let root = small_tree ( ) ;
51
+ b. iter ( || {
52
+ let mut c = root. add_child ( "1" ) ;
53
+ let _one = c. add_child ( "1" ) ;
54
+ let _two = c. add_child ( "2" ) ;
55
+ let _three = c. add_child ( "3" ) ;
56
+ } ) ;
57
+ } ) ;
41
58
c. benchmark_group ( "tree::Item::message" )
42
59
. throughput ( Throughput :: Elements ( 1 ) )
43
60
. bench_function (
0 commit comments