-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathkanal-async.rs
62 lines (57 loc) · 3.33 KB
/
kanal-async.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use kanal::{bounded_async, unbounded_async, AsyncReceiver, AsyncSender};
std::include!("settings.rs");
fn new<T>(cap: Option<usize>) -> (AsyncSender<T>, AsyncReceiver<T>) {
match cap {
None => unbounded_async(),
Some(cap) => bounded_async(cap),
}
}
std::include!("z_types.rs");
std::include!("z_async_all.rs");
std::include!("z_run.rs");
#[tokio::main]
async fn main() {
println!("kanal-async");
run_async!("bounded0_mpmc(empty)", mpmc::<BenchEmpty>(Some(0)));
run_async!("bounded0_mpsc(empty)", mpsc::<BenchEmpty>(Some(0)));
run_async!("bounded0_spsc(empty)", spsc::<BenchEmpty>(Some(0)));
run_async!("bounded1_mpmc(empty)", mpmc::<BenchEmpty>(Some(1)));
run_async!("bounded1_mpsc(empty)", mpsc::<BenchEmpty>(Some(1)));
run_async!("bounded1_spsc(empty)", spsc::<BenchEmpty>(Some(1)));
run_async!("bounded_mpmc(empty)", mpmc::<BenchEmpty>(Some(MESSAGES)));
run_async!("bounded_mpsc(empty)", mpsc::<BenchEmpty>(Some(MESSAGES)));
run_async!("bounded_seq(empty)", seq::<BenchEmpty>(Some(MESSAGES)));
run_async!("bounded_spsc(empty)", spsc::<BenchEmpty>(Some(MESSAGES)));
run_async!("unbounded_mpmc(empty)", mpmc::<BenchEmpty>(None));
run_async!("unbounded_mpsc(empty)", mpsc::<BenchEmpty>(None));
run_async!("unbounded_seq(empty)", seq::<BenchEmpty>(None));
run_async!("unbounded_spsc(empty)", spsc::<BenchEmpty>(None));
run_async!("bounded0_mpmc(usize)", mpmc::<BenchUsize>(Some(0)));
run_async!("bounded0_mpsc(usize)", mpsc::<BenchUsize>(Some(0)));
run_async!("bounded0_spsc(usize)", spsc::<BenchUsize>(Some(0)));
run_async!("bounded1_mpmc(usize)", mpmc::<BenchUsize>(Some(1)));
run_async!("bounded1_mpsc(usize)", mpsc::<BenchUsize>(Some(1)));
run_async!("bounded1_spsc(usize)", spsc::<BenchUsize>(Some(1)));
run_async!("bounded_mpmc(usize)", mpmc::<BenchUsize>(Some(MESSAGES)));
run_async!("bounded_mpsc(usize)", mpsc::<BenchUsize>(Some(MESSAGES)));
run_async!("bounded_seq(usize)", seq::<BenchUsize>(Some(MESSAGES)));
run_async!("bounded_spsc(usize)", spsc::<BenchUsize>(Some(MESSAGES)));
run_async!("unbounded_mpmc(usize)", mpmc::<BenchUsize>(None));
run_async!("unbounded_mpsc(usize)", mpsc::<BenchUsize>(None));
run_async!("unbounded_seq(usize)", seq::<BenchUsize>(None));
run_async!("unbounded_spsc(usize)", spsc::<BenchUsize>(None));
run_async!("bounded0_mpmc(big)", mpmc::<BenchFixedArray>(Some(0)));
run_async!("bounded0_mpsc(big)", mpsc::<BenchFixedArray>(Some(0)));
run_async!("bounded0_spsc(big)", spsc::<BenchFixedArray>(Some(0)));
run_async!("bounded1_mpmc(big)", mpmc::<BenchFixedArray>(Some(1)));
run_async!("bounded1_mpsc(big)", mpsc::<BenchFixedArray>(Some(1)));
run_async!("bounded1_spsc(big)", spsc::<BenchFixedArray>(Some(1)));
run_async!("bounded_mpmc(big)", mpmc::<BenchFixedArray>(Some(MESSAGES)));
run_async!("bounded_mpsc(big)", mpsc::<BenchFixedArray>(Some(MESSAGES)));
run_async!("bounded_seq(big)", seq::<BenchFixedArray>(Some(MESSAGES)));
run_async!("bounded_spsc(big)", spsc::<BenchFixedArray>(Some(MESSAGES)));
run_async!("unbounded_mpmc(big)", mpmc::<BenchFixedArray>(None));
run_async!("unbounded_mpsc(big)", mpsc::<BenchFixedArray>(None));
run_async!("unbounded_seq(big)", seq::<BenchFixedArray>(None));
run_async!("unbounded_spsc(big)", spsc::<BenchFixedArray>(None));
}