test: add benchmark for creating a plugin with the cache disabled (#736)

This commit is contained in:
zach
2024-07-10 11:18:08 -07:00
committed by GitHub
parent 17a546b2db
commit 8312e98463

View File

@@ -35,6 +35,21 @@ pub fn create_plugin(c: &mut Criterion) {
});
}
pub fn create_plugin_no_cache(c: &mut Criterion) {
let mut g = c.benchmark_group("create");
g.noise_threshold(1.0);
g.significance_level(0.2);
g.bench_function("create_plugin_no_cache", |b| {
b.iter(|| {
let _plugin = PluginBuilder::new(COUNT_VOWELS)
.with_cache_disabled()
.with_wasi(true)
.build()
.unwrap();
})
});
}
#[derive(Debug, serde::Deserialize, PartialEq)]
struct Count {
count: u32,
@@ -251,6 +266,7 @@ criterion_group!(
reflect_linked,
basic,
create_plugin,
create_plugin_no_cache,
count_vowels
);
criterion_main!(benches);