We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3656ef7 commit 6626151Copy full SHA for 6626151
rust/benches/rpc.rs
@@ -1,6 +1,7 @@
1
use std::collections::HashSet;
2
3
use criterion::*;
4
+use futures::future::join_all;
5
use hdfs_native::{minidfs::MiniDfs, Client, WriteOptions};
6
7
fn bench(c: &mut Criterion) {
@@ -34,6 +35,23 @@ fn bench(c: &mut Criterion) {
34
35
let fs = hdfs::hdfs::get_hdfs().unwrap();
36
b.iter(|| fs.get_file_status("/bench").unwrap())
37
});
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
+ });
55
}
56
57
criterion_group!(benches, bench);
0 commit comments