cargo bench builds and runs a package's benchmarks. With Criterion configured, it also runs unit tests, warms caches, collects samples, and reports estimated iteration times with confidence intervals. section 6.5
A typical Criterion benchmark requires:
- black_box around computed results so the compiler does not optimize away unused work. section 6.5
Run benchmarks
From the package directory, run cargo bench. Criterion warms up for three seconds, collects samples for about five seconds, and prints a timing interval such as [257.13 ps, 261.71 ps, 266.79 ps].

