Rust Benchmark Runner
Run Criterion benchmarks directly from VS Code with a single click.
Features
- 🎯 Auto-detect
fn benchmark_xxx(c: &mut Criterion) functions in benches/ directory
- ▶️ One-click run individual benchmarks
- 📊 Automatic report link generation
- 🌐 Open benchmark reports in browser with Cmd+Click
Usage
- Open a Rust benchmark file in
benches/ directory
- Click the "▶ Run Benchmark" button above any benchmark function
- View the results in the integrated terminal
- Click the link or "Open Report" button to view the detailed report
Example
// benches/kv_store_benchmark.rs
use criterion::{black_box, criterion_group, criterion_main, Criterion};
fn benchmark_concurrent_read(c: &mut Criterion) {
// Your benchmark code here
c.bench_function("concurrent_read", |b| {
b.iter(|| {
// Benchmark logic
});
});
}
criterion_group!(benches, benchmark_concurrent_read);
criterion_main!(benches);
Click "▶ Run Benchmark" above benchmark_concurrent_read to execute.
Configuration
You can configure the benchmark directory in your settings.json:
{
"rustBenchRunner.benchDir": "benches"
}
Requirements
- Rust with Criterion
- VS Code 1.85.0+
License
MIT
| |