Jesús Pérez 09a97ac8f5
chore: update platform submodule to monorepo crates structure
Platform restructured into crates/, added AI service and detector,
       migrated control-center-ui to Leptos 0.8
2026-01-08 21:32:59 +00:00

62 lines
1.8 KiB
Rust

use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use provisioning_mcp_server::{Config, ProvisioningEngine, ProvisioningTools};
fn bench_server_parsing(c: &mut Criterion) {
let config = Config::default();
let tools = ProvisioningTools::new(&config);
let test_cases = vec![
"Create 1 server for web hosting",
"Create 3 servers with 8 CPU cores for kubernetes cluster on AWS",
"Deploy 5 t3.large instances in us-west-2 for database cluster",
"Setup 2 medium servers with 4 CPU cores for local development",
];
let mut group = c.benchmark_group("server_parsing");
for case in &test_cases {
group.bench_with_input(
BenchmarkId::new("parse_description", case.len()),
case,
|b, case| {
b.iter(|| tools.parse_server_description(std::hint::black_box(case)));
},
);
}
group.finish();
}
fn bench_ai_status(c: &mut Criterion) {
let config = Config::default();
let tools = ProvisioningTools::new(&config);
c.bench_function("ai_status", |b| {
b.iter(|| tools.get_ai_status());
});
}
#[allow(clippy::field_reassign_with_default)]
fn bench_infrastructure_status(c: &mut Criterion) {
let mut config = Config::default();
// Use current directory to avoid path issues in tests
config.provisioning_path = std::env::current_dir().unwrap();
if let Ok(engine) = ProvisioningEngine::new(&config) {
c.bench_function("infrastructure_status", |b| {
b.iter(|| {
// This will likely fail but we're measuring the time it takes
let _ = engine.get_status(None, false);
});
});
}
}
criterion_group!(
benches,
bench_server_parsing,
bench_ai_status,
bench_infrastructure_status
);
criterion_main!(benches);