Skip to content

Commit

Permalink
Revert "fix: add more opaque black boxes in the tests"
Browse files Browse the repository at this point in the history
This reverts commit ac7e208.
  • Loading branch information
art049 committed Jul 26, 2023
1 parent bb6087f commit 2e2ca37
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use codspeed_criterion_compat::{black_box, criterion_group, BenchmarkId, Criterion};
use codspeed_criterion_compat::{criterion_group, BenchmarkId, Criterion};

fn fibonacci_slow(n: u64) -> u64 {
match n {
Expand Down Expand Up @@ -27,16 +27,14 @@ fn fibonacci_fast(n: u64) -> u64 {
fn compare_fibonaccis(c: &mut Criterion) {
let mut group = c.benchmark_group("Fibonacci");

group.bench_with_input("Recursive", &20, |b, i| {
b.iter(|| fibonacci_slow(black_box(*i)))
});
group.bench_with_input("Recursive", &20, |b, i| b.iter(|| fibonacci_slow(*i)));
group.bench_with_input("Iterative", &20, |b, i| b.iter(|| fibonacci_fast(*i)));
}
fn compare_fibonaccis_group(c: &mut Criterion) {
let mut group = c.benchmark_group("Fibonacci3");
for i in 20..=21 {
group.bench_with_input(BenchmarkId::new("Recursive", i), &i, |b, i| {
b.iter(|| fibonacci_slow(black_box(*i)))
b.iter(|| fibonacci_slow(*i))
});
group.bench_with_input(BenchmarkId::new("Iterative", i), &i, |b, i| {
b.iter(|| fibonacci_fast(*i))
Expand Down

0 comments on commit 2e2ca37

Please sign in to comment.