1
- use std:: sync:: Arc ;
2
1
use std:: time:: Duration ;
3
2
4
3
mod helpers;
@@ -20,30 +19,30 @@ fn add_one_torrent(c: &mut Criterion) {
20
19
group. measurement_time ( Duration :: from_millis ( 1000 ) ) ;
21
20
22
21
group. bench_function ( "RwLockStd" , |b| {
23
- b. iter_custom ( sync:: add_one_torrent :: < Arc < TorrentsRwLockStd > > ) ;
22
+ b. iter_custom ( sync:: add_one_torrent :: < TorrentsRwLockStd , _ > ) ;
24
23
} ) ;
25
24
26
25
group. bench_function ( "RwLockStdMutexStd" , |b| {
27
- b. iter_custom ( sync:: add_one_torrent :: < Arc < TorrentsRwLockStdMutexStd > > ) ;
26
+ b. iter_custom ( sync:: add_one_torrent :: < TorrentsRwLockStdMutexStd , _ > ) ;
28
27
} ) ;
29
28
30
29
group. bench_function ( "RwLockStdMutexTokio" , |b| {
31
30
b. to_async ( & rt)
32
- . iter_custom ( asyn:: add_one_torrent :: < Arc < TorrentsRwLockStdMutexTokio > > ) ;
31
+ . iter_custom ( asyn:: add_one_torrent :: < TorrentsRwLockStdMutexTokio , _ > ) ;
33
32
} ) ;
34
33
35
34
group. bench_function ( "RwLockTokio" , |b| {
36
- b. to_async ( & rt) . iter_custom ( asyn:: add_one_torrent :: < Arc < TorrentsRwLockTokio > > ) ;
35
+ b. to_async ( & rt) . iter_custom ( asyn:: add_one_torrent :: < TorrentsRwLockTokio , _ > ) ;
37
36
} ) ;
38
37
39
38
group. bench_function ( "RwLockTokioMutexStd" , |b| {
40
39
b. to_async ( & rt)
41
- . iter_custom ( asyn:: add_one_torrent :: < Arc < TorrentsRwLockTokioMutexStd > > ) ;
40
+ . iter_custom ( asyn:: add_one_torrent :: < TorrentsRwLockTokioMutexStd , _ > ) ;
42
41
} ) ;
43
42
44
43
group. bench_function ( "RwLockTokioMutexTokio" , |b| {
45
44
b. to_async ( & rt)
46
- . iter_custom ( asyn:: add_one_torrent :: < Arc < TorrentsRwLockTokioMutexTokio > > ) ;
45
+ . iter_custom ( asyn:: add_one_torrent :: < TorrentsRwLockTokioMutexTokio , _ > ) ;
47
46
} ) ;
48
47
49
48
group. finish ( ) ;
@@ -62,32 +61,32 @@ fn add_multiple_torrents_in_parallel(c: &mut Criterion) {
62
61
63
62
group. bench_function ( "RwLockStd" , |b| {
64
63
b. to_async ( & rt)
65
- . iter_custom ( |iters| sync:: add_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockStd > > ( & rt, iters, None ) ) ;
64
+ . iter_custom ( |iters| sync:: add_multiple_torrents_in_parallel :: < TorrentsRwLockStd , _ > ( & rt, iters, None ) ) ;
66
65
} ) ;
67
66
68
67
group. bench_function ( "RwLockStdMutexStd" , |b| {
69
68
b. to_async ( & rt)
70
- . iter_custom ( |iters| sync:: add_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockStdMutexStd > > ( & rt, iters, None ) ) ;
69
+ . iter_custom ( |iters| sync:: add_multiple_torrents_in_parallel :: < TorrentsRwLockStdMutexStd , _ > ( & rt, iters, None ) ) ;
71
70
} ) ;
72
71
73
72
group. bench_function ( "RwLockStdMutexTokio" , |b| {
74
73
b. to_async ( & rt)
75
- . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockStdMutexTokio > > ( & rt, iters, None ) ) ;
74
+ . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < TorrentsRwLockStdMutexTokio , _ > ( & rt, iters, None ) ) ;
76
75
} ) ;
77
76
78
77
group. bench_function ( "RwLockTokio" , |b| {
79
78
b. to_async ( & rt)
80
- . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockTokio > > ( & rt, iters, None ) ) ;
79
+ . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < TorrentsRwLockTokio , _ > ( & rt, iters, None ) ) ;
81
80
} ) ;
82
81
83
82
group. bench_function ( "RwLockTokioMutexStd" , |b| {
84
83
b. to_async ( & rt)
85
- . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockTokioMutexStd > > ( & rt, iters, None ) ) ;
84
+ . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < TorrentsRwLockTokioMutexStd , _ > ( & rt, iters, None ) ) ;
86
85
} ) ;
87
86
88
87
group. bench_function ( "RwLockTokioMutexTokio" , |b| {
89
88
b. to_async ( & rt)
90
- . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockTokioMutexTokio > > ( & rt, iters, None ) ) ;
89
+ . iter_custom ( |iters| asyn:: add_multiple_torrents_in_parallel :: < TorrentsRwLockTokioMutexTokio , _ > ( & rt, iters, None ) ) ;
91
90
} ) ;
92
91
93
92
group. finish ( ) ;
@@ -106,32 +105,32 @@ fn update_one_torrent_in_parallel(c: &mut Criterion) {
106
105
107
106
group. bench_function ( "RwLockStd" , |b| {
108
107
b. to_async ( & rt)
109
- . iter_custom ( |iters| sync:: update_one_torrent_in_parallel :: < Arc < TorrentsRwLockStd > > ( & rt, iters, None ) ) ;
108
+ . iter_custom ( |iters| sync:: update_one_torrent_in_parallel :: < TorrentsRwLockStd , _ > ( & rt, iters, None ) ) ;
110
109
} ) ;
111
110
112
111
group. bench_function ( "RwLockStdMutexStd" , |b| {
113
112
b. to_async ( & rt)
114
- . iter_custom ( |iters| sync:: update_one_torrent_in_parallel :: < Arc < TorrentsRwLockStdMutexStd > > ( & rt, iters, None ) ) ;
113
+ . iter_custom ( |iters| sync:: update_one_torrent_in_parallel :: < TorrentsRwLockStdMutexStd , _ > ( & rt, iters, None ) ) ;
115
114
} ) ;
116
115
117
116
group. bench_function ( "RwLockStdMutexTokio" , |b| {
118
117
b. to_async ( & rt)
119
- . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < Arc < TorrentsRwLockStdMutexTokio > > ( & rt, iters, None ) ) ;
118
+ . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < TorrentsRwLockStdMutexTokio , _ > ( & rt, iters, None ) ) ;
120
119
} ) ;
121
120
122
121
group. bench_function ( "RwLockTokio" , |b| {
123
122
b. to_async ( & rt)
124
- . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < Arc < TorrentsRwLockTokio > > ( & rt, iters, None ) ) ;
123
+ . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < TorrentsRwLockTokio , _ > ( & rt, iters, None ) ) ;
125
124
} ) ;
126
125
127
126
group. bench_function ( "RwLockTokioMutexStd" , |b| {
128
127
b. to_async ( & rt)
129
- . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < Arc < TorrentsRwLockTokioMutexStd > > ( & rt, iters, None ) ) ;
128
+ . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < TorrentsRwLockTokioMutexStd , _ > ( & rt, iters, None ) ) ;
130
129
} ) ;
131
130
132
131
group. bench_function ( "RwLockTokioMutexTokio" , |b| {
133
132
b. to_async ( & rt)
134
- . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < Arc < TorrentsRwLockTokioMutexTokio > > ( & rt, iters, None ) ) ;
133
+ . iter_custom ( |iters| asyn:: update_one_torrent_in_parallel :: < TorrentsRwLockTokioMutexTokio , _ > ( & rt, iters, None ) ) ;
135
134
} ) ;
136
135
137
136
group. finish ( ) ;
@@ -150,34 +149,32 @@ fn update_multiple_torrents_in_parallel(c: &mut Criterion) {
150
149
151
150
group. bench_function ( "RwLockStd" , |b| {
152
151
b. to_async ( & rt)
153
- . iter_custom ( |iters| sync:: update_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockStd > > ( & rt, iters, None ) ) ;
152
+ . iter_custom ( |iters| sync:: update_multiple_torrents_in_parallel :: < TorrentsRwLockStd , _ > ( & rt, iters, None ) ) ;
154
153
} ) ;
155
154
156
155
group. bench_function ( "RwLockStdMutexStd" , |b| {
157
156
b. to_async ( & rt)
158
- . iter_custom ( |iters| sync:: update_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockStdMutexStd > > ( & rt, iters, None ) ) ;
157
+ . iter_custom ( |iters| sync:: update_multiple_torrents_in_parallel :: < TorrentsRwLockStdMutexStd , _ > ( & rt, iters, None ) ) ;
159
158
} ) ;
160
159
161
160
group. bench_function ( "RwLockStdMutexTokio" , |b| {
162
- b. to_async ( & rt) . iter_custom ( |iters| {
163
- asyn:: update_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockStdMutexTokio > > ( & rt, iters, None )
164
- } ) ;
161
+ b. to_async ( & rt)
162
+ . iter_custom ( |iters| asyn:: update_multiple_torrents_in_parallel :: < TorrentsRwLockStdMutexTokio , _ > ( & rt, iters, None ) ) ;
165
163
} ) ;
166
164
167
165
group. bench_function ( "RwLockTokio" , |b| {
168
166
b. to_async ( & rt)
169
- . iter_custom ( |iters| asyn:: update_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockTokio > > ( & rt, iters, None ) ) ;
167
+ . iter_custom ( |iters| asyn:: update_multiple_torrents_in_parallel :: < TorrentsRwLockTokio , _ > ( & rt, iters, None ) ) ;
170
168
} ) ;
171
169
172
170
group. bench_function ( "RwLockTokioMutexStd" , |b| {
173
- b. to_async ( & rt) . iter_custom ( |iters| {
174
- asyn:: update_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockTokioMutexStd > > ( & rt, iters, None )
175
- } ) ;
171
+ b. to_async ( & rt)
172
+ . iter_custom ( |iters| asyn:: update_multiple_torrents_in_parallel :: < TorrentsRwLockTokioMutexStd , _ > ( & rt, iters, None ) ) ;
176
173
} ) ;
177
174
178
175
group. bench_function ( "RwLockTokioMutexTokio" , |b| {
179
176
b. to_async ( & rt) . iter_custom ( |iters| {
180
- asyn:: update_multiple_torrents_in_parallel :: < Arc < TorrentsRwLockTokioMutexTokio > > ( & rt, iters, None )
177
+ asyn:: update_multiple_torrents_in_parallel :: < TorrentsRwLockTokioMutexTokio , _ > ( & rt, iters, None )
181
178
} ) ;
182
179
} ) ;
183
180
0 commit comments