gfx-rs/wgpu
benches
benches (benches/) is the Criterion-based benchmark crate.
Purpose
- Track the performance of hot paths in
wgpuandwgpu-core: command-encoder recording, render-pass setup, shader compilation, ... - Catch performance regressions in CI by running each benchmark for a single iteration.
- Provide a place for maintainers to drill into a perf issue.
Directory layout
benches/
├── Cargo.toml
├── README.md
└── benches/
└── wgpu-benchmark/...Run them
cargo bench # full Criterion run (slow)
cargo nextest run --bench wgpu-benchmark # smoke run, one iteration each (CI does this)docs/testing.md notes that benchmarks should avoid expensive setup outside the Criterion benchmark functions — otherwise listing tests becomes slow and CI's smoke run drags.
Hot paths benchmarked
The benchmark file names describe what's measured: computepass.rs for compute-pass encoding, renderpass.rs for render-pass encoding, shader.rs for shader compilation, resource_creation.rs for buffer/texture creation, etc.
Integration points
- Above: developers tracking performance.
- Below:
wgpu(which transitively pulls in everything else).
When to add a benchmark
When you optimize a hot path, add (or extend) a benchmark in benches/benches/wgpu-benchmark/ so the gain is measurable. Future regressions on the same path will show up in the Criterion comparison.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.