This repository was archived by the owner on Oct 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,19 @@ version = "0.1.0"
4
4
authors = [
" Heinz N. Gies <[email protected] >" ]
5
5
edition = " 2018"
6
6
7
- # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
-
7
+ [features ]
8
+ default = [" cpb" ]
9
+ cpb = []
9
10
10
11
[dev-dependencies ]
11
12
proptest = " 0.10"
12
13
criterion = " 0.3"
13
14
mimalloc = " 0.1"
14
15
core_affinity = " *"
15
16
17
+ [target .'cfg(any(target_arch = "x86_64", target_arch = "x86"))' .dev-dependencies ]
18
+ criterion-cycles-per-byte = " 0.1"
19
+
16
20
[[bench ]]
17
21
name = " criterion_bench"
18
22
harness = false
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ extern crate core_affinity;
2
2
#[ macro_use]
3
3
extern crate criterion;
4
4
5
+ #[ cfg( all( any( target_arch = "x86_64" , target_arch = "x86" ) , feature = "cpb" ) ) ]
6
+ use criterion_cycles_per_byte:: CyclesPerByte ;
7
+
5
8
use mimalloc:: MiMalloc ;
6
9
#[ global_allocator]
7
10
static GLOBAL : MiMalloc = MiMalloc ;
@@ -47,5 +50,11 @@ fn bench_all<T: Measurement>(c: &mut Criterion<T>) {
47
50
bench_file ( c, "ascii_sample_ok" , true ) ;
48
51
}
49
52
50
- criterion_group ! ( benches, bench_all) ;
53
+ #[ cfg( all( any( target_arch = "x86_64" , target_arch = "x86" ) , feature = "cpb" ) ) ]
54
+ criterion_group ! {
55
+ name = benches;
56
+ config = Criterion :: default ( ) . with_measurement( CyclesPerByte ) ;
57
+ targets = bench_all
58
+ }
59
+
51
60
criterion_main ! ( benches) ;
You can’t perform that action at this time.
0 commit comments