# Objective
- Please see #16647 for the full reasoning behind this change.
## Solution
- Create the `bench!` macro, which generates the name of the benchmark
at compile time.
Migrating is a single line change, and it will automatically update if
you move the benchmark to a different module:
```diff
+ use benches::bench;
fn my_benchmark(c: &mut Criterion) {
- c.bench_function("my_benchmark", |b| {});
+ c.bench_function(bench!("my_benchmark"), |b| {});
}
```
- Migrate all reflection benchmarks to use `bench!`.
- Fix a few places where `black_box()` or Criterion is misused.
## Testing
```sh
cd benches
# Will take a long time!
cargo bench --bench reflect
# List out the names of all reflection benchmarks, to ensure I didn't miss anything.
cargo bench --bench reflect -- --list
# Check for linter warnings.
cargo clippy --bench reflect
# Run each benchmark once.
cargo test --bench reflect
```