bheisler / criterion.rs

Statistics-driven benchmarking library for Rust
Apache License 2.0
4.31k stars 292 forks source link

The `black_box` function can be replaced with `std::hint::black_box` #700

Closed Spartan2909 closed 1 day ago

Spartan2909 commented 1 year ago

The function std::hint::black_box is a stable wrapper around the same intrinsic that test::black_box uses, and could replace Criterion's own black_box function on all release channels. This function has been stable since 1.66, meaning that the last three minor versions of Rust are supported.

coolreader18 commented 2 months ago

Note that the current black_box implementation actually can lead to an llvm crash: rust-lang/rust#110381