From d4fceea5d186db34075286447448deba9f10f987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Fri, 11 Dec 2020 17:26:50 +0100 Subject: [PATCH] cossin: bench against (i32 as f32).sin_cos() --- dsp/benches/cossin.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dsp/benches/cossin.rs b/dsp/benches/cossin.rs index f082c7b..cbd0499 100644 --- a/dsp/benches/cossin.rs +++ b/dsp/benches/cossin.rs @@ -2,7 +2,11 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; use dsp::trig::cossin; 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);