Update tests, examples, benches
This commit is contained in:
1 parent
bacac903b3
commit
85ccd7e507
89 files changed
+942
-1785
No files matched your search
@@ -3,6 +3,7 @@
|
||||
//! Long sequential chain: 100 tasks in sequence
|
||||
|
||||
use criterion::Criterion;
|
||||
use futures::FutureExt;
|
||||
|
||||
pub fn bench_deep_chain(c: &mut Criterion) {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -27,11 +28,9 @@ pub fn bench_deep_chain(c: &mut Criterion) {
|
||||
.depends_on(prev);
|
||||
}
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
dag.run(|fut| tokio::spawn(fut).map(Result::unwrap))
|
||||
.await
|
||||
.unwrap();
|
||||
dag.get(prev).unwrap()
|
||||
})
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//! Classic diamond: A → B,C → D
|
||||
|
||||
use criterion::Criterion;
|
||||
use futures::FutureExt;
|
||||
|
||||
pub fn bench_diamond_pattern(c: &mut Criterion) {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -27,11 +28,9 @@ pub fn bench_diamond_pattern(c: &mut Criterion) {
|
||||
.add_task(task_fn(|(x, y): (i32, i32)| async move { x + y }))
|
||||
.depends_on((&b, &c));
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
dag.run(|fut| tokio::spawn(fut).map(Result::unwrap))
|
||||
.await
|
||||
.unwrap();
|
||||
dag.get(d).unwrap()
|
||||
})
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//! Extract → Transform → Validate → Load pattern
|
||||
|
||||
use criterion::Criterion;
|
||||
use futures::FutureExt;
|
||||
|
||||
pub fn bench_etl_pipeline(c: &mut Criterion) {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -66,11 +67,9 @@ pub fn bench_etl_pipeline(c: &mut Criterion) {
|
||||
}))
|
||||
.depends_on(validate);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
dag.run(|fut| tokio::spawn(fut).map(Result::unwrap))
|
||||
.await
|
||||
.unwrap();
|
||||
dag.get(load).unwrap()
|
||||
})
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//! 10,000 independent tasks to test scaling
|
||||
|
||||
use criterion::Criterion;
|
||||
use futures::FutureExt;
|
||||
|
||||
pub fn bench_large_scale(c: &mut Criterion) {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -21,11 +22,9 @@ pub fn bench_large_scale(c: &mut Criterion) {
|
||||
dag.add_task(task_fn(move |_: ()| async move { i * 2 }));
|
||||
}
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
dag.run(|fut| tokio::spawn(fut).map(Result::unwrap))
|
||||
.await
|
||||
.unwrap();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//! Simple chain of tasks: A → B → C → D → E
|
||||
|
||||
use criterion::Criterion;
|
||||
use futures::FutureExt;
|
||||
|
||||
pub fn bench_linear_pipeline(c: &mut Criterion) {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -30,11 +31,9 @@ pub fn bench_linear_pipeline(c: &mut Criterion) {
|
||||
.add_task(task_fn(|x: i32| async move { x * 3 }))
|
||||
.depends_on(d);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
dag.run(|fut| tokio::spawn(fut).map(Result::unwrap))
|
||||
.await
|
||||
.unwrap();
|
||||
dag.get(e).unwrap()
|
||||
})
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//! One source task feeding 100 dependent tasks
|
||||
|
||||
use criterion::Criterion;
|
||||
use futures::FutureExt;
|
||||
|
||||
pub fn bench_wide_fanout(c: &mut Criterion) {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -23,11 +24,9 @@ pub fn bench_wide_fanout(c: &mut Criterion) {
|
||||
.depends_on(&source);
|
||||
}
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
dag.run(|fut| tokio::spawn(fut).map(Result::unwrap))
|
||||
.await
|
||||
.unwrap();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user