No code coverage for benchmarks
Some checks failed
timw4mail/rusty-numbers/pipeline/head There was a failure building this commit

This commit is contained in:
Timothy Warren 2020-03-05 08:32:38 -05:00
parent 272b7360f5
commit f352c1aa4e
2 changed files with 89 additions and 84 deletions

View File

@ -1,8 +1,12 @@
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use criterion::{criterion_group, criterion_main};
#[cfg_attr(tarpaulin, skip)]
mod sf {
use criterion::{black_box, BenchmarkId, Criterion};
use rusty_numbers::num::Unsigned; use rusty_numbers::num::Unsigned;
use rusty_numbers::{factorial, fibonacci, it_factorial, mem_fibonacci, rec_fibonacci}; use rusty_numbers::{factorial, fibonacci, it_factorial, mem_fibonacci, rec_fibonacci};
fn bench_factorial(c: &mut Criterion) { pub fn bench_factorial(c: &mut Criterion) {
let mut group = c.benchmark_group("Factorials"); let mut group = c.benchmark_group("Factorials");
for i in [0usize, 5, 10, 15, 20, 25, 30, 34].iter() { for i in [0usize, 5, 10, 15, 20, 25, 30, 34].iter() {
@ -16,7 +20,7 @@ fn bench_factorial(c: &mut Criterion) {
group.finish(); group.finish();
} }
fn bench_fibonacci(c: &mut Criterion) { pub fn bench_fibonacci(c: &mut Criterion) {
let mut group = c.benchmark_group("Fibonacci"); let mut group = c.benchmark_group("Fibonacci");
for i in [0usize, 10, 20, 30, 40, 50, 70, 93, 140, 186].iter() { for i in [0usize, 10, 20, 30, 40, 50, 70, 93, 140, 186].iter() {
@ -39,7 +43,7 @@ fn bench_fibonacci(c: &mut Criterion) {
group.finish(); group.finish();
} }
fn bench_gcd(c: &mut Criterion) { pub fn bench_gcd(c: &mut Criterion) {
let mut group = c.benchmark_group("GCD"); let mut group = c.benchmark_group("GCD");
#[derive(Debug)] #[derive(Debug)]
@ -96,6 +100,8 @@ fn bench_gcd(c: &mut Criterion) {
} }
group.finish(); group.finish();
} }
}
criterion_group!(benches, bench_factorial, bench_fibonacci, bench_gcd); criterion_group!(benches, sf::bench_factorial, sf::bench_fibonacci, sf::bench_gcd);
criterion_main!(benches); criterion_main!(benches);

View File

@ -6,7 +6,6 @@
use std::f64::consts::PI; use std::f64::consts::PI;
use std::f64::consts::E; use std::f64::consts::E;
#[cfg_attr(tarpaulin, skip)]
pub mod bigint; pub mod bigint;
pub mod num; pub mod num;
pub mod rational; pub mod rational;