Skip to content

Commit

Permalink
Merge branch 'master' into faster-output
Browse files Browse the repository at this point in the history
  • Loading branch information
DavJCosby authored Mar 26, 2024
2 parents 57acd49 + 117879a commit 2ab6837
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion benches/comet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ fn trail(c: &mut Criterion) {
let total_steps = (simulated_duration * simulated_hz) as usize;
let timestep = Duration::from_secs_f32(1.0 / simulated_hz);
let mut r = 0;

c.bench_function("quirky_trail", |b| {
b.iter(|| {
for _ in 0..total_steps {
driver.step_by(timestep);

let mut colors = driver.colors_coerced::<u8>();
r = colors.next().unwrap().red;
}
})
});
});
println!("{}", r);
}
Expand Down
5 changes: 3 additions & 2 deletions benches/ripples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ fn ripples(c: &mut Criterion) {
b.iter(|| {
for _ in 0..total_steps {
driver.step_by(timestep);

let mut colors = driver.colors_coerced::<u8>();
r = colors.next().unwrap().red;
}
})
});
});
println!("{}", r);
println!("{}", r); // prevent compiler from optimizing away output steps
}

use criterion::{criterion_group, criterion_main, Criterion};
Expand Down

0 comments on commit 2ab6837

Please sign in to comment.