cossin: bench against (i32 as f32).sin_cos()
This commit is contained in:
parent
5cd93d3318
commit
d4fceea5d1
|
@ -2,7 +2,11 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||||
use dsp::trig::cossin;
|
use dsp::trig::cossin;
|
||||||
|
|
||||||
fn cossin_bench(c: &mut Criterion) {
|
fn cossin_bench(c: &mut Criterion) {
|
||||||
c.bench_function("cossin(0)", |b| b.iter(|| cossin(black_box(0))));
|
let z = -0x7304_2531_i32;
|
||||||
|
c.bench_function("cossin(z)", |b| b.iter(|| cossin(black_box(z))));
|
||||||
|
c.bench_function("(z as f32).sin_cos()", |b| {
|
||||||
|
b.iter(|| (black_box(z) as f32).sin_cos())
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
criterion_group!(benches, cossin_bench);
|
criterion_group!(benches, cossin_bench);
|
||||||
|
|
Loading…
Reference in New Issue