Fun with benchmarking. Reverted to using built-in trigonometric functions!

This commit is contained in:
mindv0rtex
2021-02-26 11:25:54 -05:00
parent fe795b536f
commit cbc3fcbe06
8 changed files with 493 additions and 19 deletions

16
benches/trig.rs Normal file
View File

@@ -0,0 +1,16 @@
use physarum::trig;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
fn bench_cos_appr(c: &mut Criterion) {
c.bench_function("Approximate cosine", |b| {
b.iter(|| trig::cos(black_box(1.0)))
});
}
fn bench_cos_exact(c: &mut Criterion) {
c.bench_function("Exact cosine", |b| b.iter(|| f32::cos(black_box(1.0))));
}
criterion_group!(benches, bench_cos_appr, bench_cos_exact);
criterion_main!(benches);