30 lines
876 B
Rust
30 lines
876 B
Rust
use criterion::{Criterion, criterion_group, criterion_main};
|
|
use skyforge::log::{LOG_LEVEL, LogLevel};
|
|
use skyforge::{Args, DeviceConfigBundle, Specification};
|
|
use std::path::PathBuf;
|
|
|
|
fn env() -> skyforge::cli::EnvVars {
|
|
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"),
|
|
}
|
|
}
|
|
|
|
fn benchmark(c: &mut Criterion) {
|
|
LOG_LEVEL.set(LogLevel::Warning).ok();
|
|
let args = Args {
|
|
devices: regex::Regex::new(".*").unwrap(),
|
|
env: env(),
|
|
};
|
|
c.bench_function("process_specs", |b| {
|
|
b.iter(|| {
|
|
DeviceConfigBundle::process_specs(Specification::compile(&args).unwrap()).unwrap();
|
|
});
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, benchmark);
|
|
criterion_main!(benches);
|