2025-06-26 17:02:54 -05:00
|
|
|
use criterion::{Criterion, criterion_group, criterion_main};
|
2024-07-15 13:45:55 -04:00
|
|
|
|
|
|
|
pub fn bench_digest(c: &mut Criterion) {
|
|
|
|
for (name, file) in [
|
|
|
|
("pipes_on_pipes", PIPES_PROGRAM),
|
|
|
|
("big_kitt", KITT_PROGRAM),
|
|
|
|
("cube", CUBE_PROGRAM),
|
|
|
|
("math", MATH_PROGRAM),
|
|
|
|
("mike_stress_test", MIKE_STRESS_TEST_PROGRAM),
|
2024-10-29 21:40:31 -04:00
|
|
|
("lsystem", LSYSTEM_PROGRAM),
|
2024-07-15 13:45:55 -04:00
|
|
|
] {
|
2024-12-06 13:57:31 +13:00
|
|
|
let prog = kcl_lib::Program::parse_no_errs(file).unwrap();
|
2024-07-15 13:45:55 -04:00
|
|
|
c.bench_function(&format!("digest_{name}"), move |b| {
|
|
|
|
let prog = prog.clone();
|
|
|
|
|
|
|
|
b.iter(move || {
|
|
|
|
let mut prog = prog.clone();
|
|
|
|
prog.compute_digest();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
criterion_group!(benches, bench_digest);
|
|
|
|
criterion_main!(benches);
|
|
|
|
|
2025-03-01 13:59:01 -08:00
|
|
|
const KITT_PROGRAM: &str = include_str!("../e2e/executor/inputs/kittycad_svg.kcl");
|
|
|
|
const PIPES_PROGRAM: &str = include_str!("../e2e/executor/inputs/pipes_on_pipes.kcl");
|
|
|
|
const CUBE_PROGRAM: &str = include_str!("../e2e/executor/inputs/cube.kcl");
|
|
|
|
const MATH_PROGRAM: &str = include_str!("../e2e/executor/inputs/math.kcl");
|
2024-11-18 16:20:32 -06:00
|
|
|
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl");
|
2025-03-01 13:59:01 -08:00
|
|
|
const LSYSTEM_PROGRAM: &str = include_str!("../e2e/executor/inputs/lsystem.kcl");
|