FF64
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
||||
use fast_fp::{ff32, FF32};
|
||||
use fast_fp::{ff32, ff64, FF32, FF64};
|
||||
use rand::{distributions::Standard, thread_rng, Rng};
|
||||
|
||||
fn sum(c: &mut Criterion) {
|
||||
@@ -26,6 +26,26 @@ fn sum(c: &mut Criterion) {
|
||||
group.bench_with_input(BenchmarkId::new("FF32", count), &ff32_vals, |b, vals| {
|
||||
b.iter(|| vals.iter().copied().fold(ff32(0.0), |acc, val| acc + val));
|
||||
});
|
||||
|
||||
let f64_vals = thread_rng()
|
||||
.sample_iter(Standard)
|
||||
.take(count)
|
||||
.collect::<Vec<f64>>();
|
||||
|
||||
// use the same values for both benchmarks
|
||||
let ff64_vals = f64_vals
|
||||
.clone()
|
||||
.into_iter()
|
||||
.map(ff64)
|
||||
.collect::<Vec<FF64>>();
|
||||
|
||||
group.bench_with_input(BenchmarkId::new("std::f64", count), &f64_vals, |b, vals| {
|
||||
b.iter(|| vals.iter().copied().fold(0.0, |acc, val| acc + val));
|
||||
});
|
||||
|
||||
group.bench_with_input(BenchmarkId::new("FF64", count), &ff64_vals, |b, vals| {
|
||||
b.iter(|| vals.iter().copied().fold(ff64(0.0), |acc, val| acc + val));
|
||||
});
|
||||
}
|
||||
group.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user