-
Notifications
You must be signed in to change notification settings - Fork 9
/
kanal.rs
66 lines (60 loc) · 3.11 KB
/
kanal.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
63
64
65
66
use kanal::{bounded, unbounded, Receiver, Sender};
std::include!("settings.rs");
std::include!("z_types.rs");
std::include!("z_seq.rs");
std::include!("z_spsc.rs");
std::include!("z_mpsc.rs");
std::include!("z_mpmc.rs");
std::include!("z_run.rs");
fn new<T>(cap: Option<usize>) -> (Sender<T>, Receiver<T>) {
match cap {
None => unbounded(),
Some(cap) => bounded(cap),
}
}
#[tokio::main]
async fn main() {
println!("kanal");
run!("bounded0_mpmc(empty)", mpmc::<BenchEmpty>(Some(0)));
run!("bounded0_mpsc(empty)", mpsc::<BenchEmpty>(Some(0)));
run!("bounded0_spsc(empty)", spsc::<BenchEmpty>(Some(0)));
run!("bounded1_mpmc(empty)", mpmc::<BenchEmpty>(Some(1)));
run!("bounded1_mpsc(empty)", mpsc::<BenchEmpty>(Some(1)));
run!("bounded1_spsc(empty)", spsc::<BenchEmpty>(Some(1)));
run!("bounded_mpmc(empty)", mpmc::<BenchEmpty>(Some(MESSAGES)));
run!("bounded_mpsc(empty)", mpsc::<BenchEmpty>(Some(MESSAGES)));
run!("bounded_seq(empty)", seq::<BenchEmpty>(Some(MESSAGES)));
run!("bounded_spsc(empty)", spsc::<BenchEmpty>(Some(MESSAGES)));
run!("unbounded_mpmc(empty)", mpmc::<BenchEmpty>(None));
run!("unbounded_mpsc(empty)", mpsc::<BenchEmpty>(None));
run!("unbounded_seq(empty)", seq::<BenchEmpty>(None));
run!("unbounded_spsc(empty)", spsc::<BenchEmpty>(None));
run!("bounded0_mpmc(usize)", mpmc::<BenchUsize>(Some(0)));
run!("bounded0_mpsc(usize)", mpsc::<BenchUsize>(Some(0)));
run!("bounded0_spsc(usize)", spsc::<BenchUsize>(Some(0)));
run!("bounded1_mpmc(usize)", mpmc::<BenchUsize>(Some(1)));
run!("bounded1_mpsc(usize)", mpsc::<BenchUsize>(Some(1)));
run!("bounded1_spsc(usize)", spsc::<BenchUsize>(Some(1)));
run!("bounded_mpmc(usize)", mpmc::<BenchUsize>(Some(MESSAGES)));
run!("bounded_mpsc(usize)", mpsc::<BenchUsize>(Some(MESSAGES)));
run!("bounded_seq(usize)", seq::<BenchUsize>(Some(MESSAGES)));
run!("bounded_spsc(usize)", spsc::<BenchUsize>(Some(MESSAGES)));
run!("unbounded_mpmc(usize)", mpmc::<BenchUsize>(None));
run!("unbounded_mpsc(usize)", mpsc::<BenchUsize>(None));
run!("unbounded_seq(usize)", seq::<BenchUsize>(None));
run!("unbounded_spsc(usize)", spsc::<BenchUsize>(None));
run!("bounded0_mpmc(big)", mpmc::<BenchFixedArray>(Some(0)));
run!("bounded0_mpsc(big)", mpsc::<BenchFixedArray>(Some(0)));
run!("bounded0_spsc(big)", spsc::<BenchFixedArray>(Some(0)));
run!("bounded1_mpmc(big)", mpmc::<BenchFixedArray>(Some(1)));
run!("bounded1_mpsc(big)", mpsc::<BenchFixedArray>(Some(1)));
run!("bounded1_spsc(big)", spsc::<BenchFixedArray>(Some(1)));
run!("bounded_mpmc(big)", mpmc::<BenchFixedArray>(Some(MESSAGES)));
run!("bounded_mpsc(big)", mpsc::<BenchFixedArray>(Some(MESSAGES)));
run!("bounded_seq(big)", seq::<BenchFixedArray>(Some(MESSAGES)));
run!("bounded_spsc(big)", spsc::<BenchFixedArray>(Some(MESSAGES)));
run!("unbounded_mpmc(big)", mpmc::<BenchFixedArray>(None));
run!("unbounded_mpsc(big)", mpsc::<BenchFixedArray>(None));
run!("unbounded_seq(big)", seq::<BenchFixedArray>(None));
run!("unbounded_spsc(big)", spsc::<BenchFixedArray>(None));
}