Skip to content

Commit

Permalink
Use std::hint::black_box consistently.
Browse files Browse the repository at this point in the history
This also removes the `#![feature(bench_black_box)]`. This was
stabilized in Rust 1.66 and anyone building benchmarks will be
on that or later (as they previously would have been on nightly).

This also allows building `cargo build --all-targets` on stable
Rust as it no longer dies when hitting the feature addition in
the benchmarks.
  • Loading branch information
waywardmonkeys committed Aug 14, 2023
1 parent 706caf5 commit 9042d14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions benches/core/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn iter(bench: &mut criterion::Criterion) {
bench.bench_function("iter", move |bh| {
bh.iter(|| {
for value in a.iter() {
criterion::black_box(value);
std::hint::black_box(value);
}
})
});
Expand All @@ -154,7 +154,7 @@ fn iter_rev(bench: &mut criterion::Criterion) {
bench.bench_function("iter_rev", move |bh| {
bh.iter(|| {
for value in a.iter().rev() {
criterion::black_box(value);
std::hint::black_box(value);
}
})
});
Expand Down
1 change: 0 additions & 1 deletion benches/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(bench_black_box)]
#![allow(unused_macros)]

extern crate nalgebra as na;
Expand Down

0 comments on commit 9042d14

Please sign in to comment.