29 lines
852 B
Rust
29 lines
852 B
Rust
use criterion::{Criterion, criterion_group, criterion_main};
|
|
use skyforge::{Args, DeviceConfigBundle, Specification};
|
|
use std::path::PathBuf;
|
|
|
|
fn benchmark(c: &mut Criterion) {
|
|
let args = Args {
|
|
devices: regex::Regex::new(".*").unwrap(),
|
|
env: skyforge::cli::EnvVars {
|
|
spec_path: PathBuf::from("./demo/spec"),
|
|
tmpl_path: PathBuf::from("./demo/tmpl"),
|
|
out_path: PathBuf::from("./demo/out"),
|
|
log_path: PathBuf::from("./demo/log"),
|
|
},
|
|
};
|
|
|
|
c.bench_function("compile", |b| {
|
|
b.iter(|| {
|
|
for spec in Specification::compile(&args) {
|
|
DeviceConfigBundle::from_spec(spec)
|
|
.unwrap()
|
|
.output_artifacts();
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, benchmark);
|
|
criterion_main!(benches);
|