Skip to content

Commit 1945c79

Browse files
committed
Merge branch 'master' into better-observer-support
2 parents 02e559c + 32510e9 commit 1945c79

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

rust/benches/rpc.rs

+18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::collections::HashSet;
22

33
use criterion::*;
4+
use futures::future::join_all;
45
use hdfs_native::{minidfs::MiniDfs, Client, WriteOptions};
56

67
fn bench(c: &mut Criterion) {
@@ -34,6 +35,23 @@ fn bench(c: &mut Criterion) {
3435
let fs = hdfs::hdfs::get_hdfs().unwrap();
3536
b.iter(|| fs.get_file_status("/bench").unwrap())
3637
});
38+
39+
group.sampling_mode(SamplingMode::Flat);
40+
group.bench_function("getFileInfo-parallel", |b| {
41+
b.to_async(&rt).iter_batched(
42+
|| {
43+
(0..100)
44+
.map(|_| client.get_file_info("/bench"))
45+
.collect::<Vec<_>>()
46+
},
47+
|futures| async {
48+
for result in join_all(futures).await {
49+
result.unwrap();
50+
}
51+
},
52+
BatchSize::SmallInput,
53+
)
54+
});
3755
}
3856

3957
criterion_group!(benches, bench);

0 commit comments

Comments
 (0)