dir-bench
dir-bench provides a macro to generate benchmarks from files in a directory.
NOTE: currently rust only supports running benchmarks in the nigthly channel.
crate based on dir-test
Usage
Add the following dependency to your Cargo.toml.
[]
= "0.1.0"
Basic Usage
extern crate test;
use Bencher;
use ;
Assuming your crate is as follows, then the above code generates two benchmarks
cases mybenchmark__foo() and mybenchmark__fixtures_a_bar().
my-crate/
├─ fixtures/
│ ├─ foo.txt
│ ├─ fixtures_a/
│ │ ├─ bar.txt
├─ src/
│ ├─ ...
│ ├─ lib.rs
├─ Cargo.toml
├─ README.md
🔽
NOTE: The dir argument must be specified in an absolute path because
of the limitation of the current procedural macro system. Consider using
environment variables, dir-bench crate resolves environment variables
internally.
Benchmark Attributes
Benchmark attributes can specified by the dir_bench_attr attribute. The
attributes inside dir_bench_attr are applied to the all generated benchmarks.
use ;