Skip to content

Glossary: Rust in Practice

black_box

Also written: std::hint::black_box

A function that hides a value from the optimizer so it can't skip work whose result looks unused. It keeps benchmarks honest.

Where the book teaches it

Related terms

benchmarkcriterion