aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-03-08 20:04:51 +0100
committerHampusM <hampus@hampusmat.com>2023-03-08 20:33:46 +0100
commit87b3898fc5d4e6ee3fed78188ea7da98c16683ab (patch)
treee5352a244cc795c64021b63edcb8f35f203a3cde
parent5045fff7674182df9751fed6d3c3aad833a241d7 (diff)
perf: add benchmark of Registry::retrieve
-rw-r--r--Cargo.toml5
-rw-r--r--benches/registry.rs12
2 files changed, 17 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 2c2f96f..a1ccbbc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,3 +29,8 @@ thiserror = "1.0.38"
[dev-dependencies]
pretty_assertions = "1.3.0"
+criterion = "0.4.0"
+
+[[bench]]
+name = "registry"
+harness = false
diff --git a/benches/registry.rs b/benches/registry.rs
new file mode 100644
index 0000000..9bfe9c4
--- /dev/null
+++ b/benches/registry.rs
@@ -0,0 +1,12 @@
+use criterion::{criterion_group, criterion_main, Criterion};
+use opengl_registry::Registry;
+
+fn bench_registry(crit: &mut Criterion)
+{
+ crit.bench_function("retrieve registry from included XML file", |bencher| {
+ bencher.iter(Registry::retrieve)
+ });
+}
+
+criterion_group!(benches, bench_registry);
+criterion_main!(benches);