File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ mod ops;
20
20
mod pattern;
21
21
mod slice;
22
22
mod str;
23
+ mod tuple;
23
24
24
25
/// Returns a `rand::Rng` seeded with a consistent seed.
25
26
///
Original file line number Diff line number Diff line change
1
+ use rand:: prelude:: * ;
2
+ use test:: { black_box, Bencher } ;
3
+
4
+ #[ bench]
5
+ fn bench_tuple_comparison ( b : & mut Bencher ) {
6
+ let mut rng = black_box ( super :: bench_rng ( ) ) ;
7
+
8
+ let data = black_box ( [
9
+ ( "core::iter::adapters::Chain" , 123_usize ) ,
10
+ ( "core::iter::adapters::Clone" , 456_usize ) ,
11
+ ( "core::iter::adapters::Copie" , 789_usize ) ,
12
+ ( "core::iter::adapters::Cycle" , 123_usize ) ,
13
+ ( "core::iter::adapters::Flatt" , 456_usize ) ,
14
+ ( "core::iter::adapters::TakeN" , 789_usize ) ,
15
+ ] ) ;
16
+
17
+ b. iter ( || {
18
+ let x = data. choose ( & mut rng) . unwrap ( ) ;
19
+ let y = data. choose ( & mut rng) . unwrap ( ) ;
20
+ [ x < y, x <= y, x > y, x >= y]
21
+ } ) ;
22
+ }
You can’t perform that action at this time.
0 commit comments