Glossary: Algorithms Beyond the Basics in Rust
Timing code (Instant, black_box)
Also written: Instant, std::time::Instant, black_box, std::hint::black_box
`Instant::now()` takes a start time and `.elapsed()` tells how long has passed. `black_box` stops the compiler from noticing a result is known and skipping the work, so the timing measures the real cost.