diff --git a/benches/nvrs_bench.rs b/benches/nvrs_bench.rs index 1674954..24bc6e3 100644 --- a/benches/nvrs_bench.rs +++ b/benches/nvrs_bench.rs @@ -8,16 +8,22 @@ fn configure_criterion() -> Criterion { } fn bench_config_load(c: &mut Criterion) { + use tokio::runtime::Runtime; + let rt = Runtime::new().unwrap(); + c.bench_function("config_load", |b| { - b.iter(|| nvrs::config::load(black_box(None))) + b.iter(|| rt.block_on(nvrs::config::load(black_box(None)))) }); } fn bench_verfile_operations(c: &mut Criterion) { - let (config_content, _, _) = nvrs::config::load(None); + use tokio::runtime::Runtime; + let rt = Runtime::new().unwrap(); + + let config = rt.block_on(nvrs::config::load(None)).unwrap(); c.bench_function("verfile_load", |b| { - b.iter(|| nvrs::verfiles::load(black_box(config_content.__config__.clone()))) + b.iter(|| rt.block_on(nvrs::verfiles::load(black_box(config.0.__config__.clone())))) }); } @@ -25,19 +31,21 @@ fn bench_api_requests(c: &mut Criterion) { use tokio::runtime::Runtime; let rt = Runtime::new().unwrap(); - let mock_package = nvrs::config::Package { - source: "aur".to_string(), - aur: "hyprland-git".to_string(), - github: String::new(), - gitlab: String::new(), - host: String::new(), - prefix: String::new(), - }; + let mock_package = nvrs::config::Package::new( + "aur".to_string(), + "hyprland-git".to_string(), + false, + String::new(), + ) + .unwrap(); + + let client = reqwest::Client::new(); c.bench_function("api_request", |b| { b.iter(|| { rt.block_on(nvrs::run_source( ("hyprland-git".to_string(), mock_package.clone()), + client.clone(), None, )) })