File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ license = "MIT"
77name = " wmidi"
88readme = " README.md"
99repository = " https://github.com/RustAudio/wmidi"
10- version = " 4.0.9 "
10+ version = " 4.0.10 "
1111
1212[lib ]
1313# Required to pass flags to criterion benchmark.
Original file line number Diff line number Diff line change @@ -96,10 +96,6 @@ fn bench_from_bytes(c: &mut Criterion) {
9696}
9797
9898fn bench_notes ( c : & mut Criterion ) {
99- let all_notes: Vec < wmidi:: Note > = ( 0 ..128 )
100- . map ( |n| wmidi:: Note :: try_from ( n) . unwrap ( ) )
101- . collect ( ) ;
102- let all_notes = black_box ( all_notes) ;
10399 c. bench_function ( "Note::try_from" , |b| {
104100 b. iter ( || {
105101 let mut notes = [ wmidi:: Note :: LOWEST_NOTE ; 128 ] ;
@@ -120,6 +116,14 @@ fn bench_notes(c: &mut Criterion) {
120116 }
121117 } )
122118 } ) ;
119+ }
120+
121+ #[ cfg( feature = "std" ) ]
122+ fn bench_frequency ( c : & mut Criterion ) {
123+ let all_notes: Vec < wmidi:: Note > = ( 0 ..128 )
124+ . map ( |n| wmidi:: Note :: try_from ( n) . unwrap ( ) )
125+ . collect ( ) ;
126+ let all_notes = black_box ( all_notes) ;
123127 c. bench_function ( "Note::to_freq_f32" , |b| {
124128 b. iter ( || {
125129 let mut freqs = [ 0f32 ; 128 ] ;
@@ -149,6 +153,15 @@ fn bench_notes(c: &mut Criterion) {
149153 } ) ;
150154}
151155
152- criterion_group ! ( benchmarks, bench_to_slice, bench_from_bytes, bench_notes) ;
156+ #[ cfg( not( feature = "std" ) ) ]
157+ fn bench_frequency ( _: & mut Criterion ) { }
158+
159+ criterion_group ! (
160+ benchmarks,
161+ bench_to_slice,
162+ bench_from_bytes,
163+ bench_notes,
164+ bench_frequency
165+ ) ;
153166
154167criterion_main ! ( benchmarks) ;
You can’t perform that action at this time.
0 commit comments