Skip to content

Commit

Permalink
fixup! feat(examples): add a more interesting benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMemories committed Mar 26, 2024
1 parent e82cf25 commit 8b346a3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions examples/benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ use riot_rs::debug::println;
#[riot_rs::thread]
fn main() {
match riot_rs::bench::benchmark(1000, || {
let mut i = 0;

// This seems to be measuring branching cost more than anything
for _ in 0..1000 {
i += 1;
core::hint::black_box(i);
}
// Insert the function to benchmark here.
// Consider using `core::hint::black_box()` where necessary.
}) {
Ok(ticks) => {
println!("took {} per iteration", ticks);
Expand Down

0 comments on commit 8b346a3

Please sign in to comment.