Skip to content

Commit c1590e4

Browse files
committed
Merge branch 'feat/dyn-progress' into simplify
Conflicts: src/lib.rs src/traits.rs
2 parents 6aba6e3 + 9d03124 commit c1590e4

File tree

3 files changed

+364
-8
lines changed

3 files changed

+364
-8
lines changed

benches/usage.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use criterion::*;
22
use prodash::{
33
messages::MessageLevel,
44
tree::{root::Options as TreeOptions, Root as Tree},
5+
BoxedDynProgress,
56
};
67

78
fn usage(c: &mut Criterion) {
@@ -13,15 +14,20 @@ fn usage(c: &mut Criterion) {
1314
.create()
1415
.into()
1516
}
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| {
1920
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;
2025
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);
2531
});
2632
});
2733
c.benchmark_group("tree::Item::set")
@@ -38,6 +44,17 @@ fn usage(c: &mut Criterion) {
3844
progress.set(5);
3945
});
4046
});
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+
});
4158
c.benchmark_group("tree::Item::message")
4259
.throughput(Throughput::Elements(1))
4360
.bench_function(

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ pub mod messages;
6464
pub mod progress;
6565

6666
mod traits;
67-
pub use traits::{Count, NestedProgress, Progress, Root, WeakRoot};
67+
pub use traits::{
68+
BoxedDynProgress, Count, DynProgress, DynProgressToProgressBridge, NestedProgress, Progress, Root, WeakRoot,
69+
};
6870

6971
mod throughput;
7072
pub use crate::throughput::Throughput;

0 commit comments

Comments
 (0)