summaryrefslogtreecommitdiff
path: root/benchmarks/quick-xml/src/main.rs
diff options
context:
space:
mode:
authorsteven-vd <steven@vandorp.lu>2026-08-16 15:00:32 +0200
committersteven-vd <steven@vandorp.lu>2026-08-17 09:31:42 +0200
commitee081ca70322cd01d0642fdb1860e6bfbfb48e85 (patch)
tree295fdba93b08b24562c6d49e971bbf3425eac50c /benchmarks/quick-xml/src/main.rs
Initial commitHEAD0.1.0master
Diffstat (limited to 'benchmarks/quick-xml/src/main.rs')
-rw-r--r--benchmarks/quick-xml/src/main.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/benchmarks/quick-xml/src/main.rs b/benchmarks/quick-xml/src/main.rs
new file mode 100644
index 0000000..fef0ee7
--- /dev/null
+++ b/benchmarks/quick-xml/src/main.rs
@@ -0,0 +1,39 @@
+use std::fs;
+
+#[path = "../../harness.rs"]
+mod harness;
+use harness::*;
+
+mod pubmed_len;
+use pubmed_len::*;
+mod count_highway_crossings;
+use count_highway_crossings::*;
+
+macro_rules! bench {
+ ($f:expr, $buffer:expr, $out:expr) => {
+ bench(String::from(stringify!($f)), $f, $buffer.as_slice(), &mut $out)
+ };
+}
+
+fn main() {
+ let mut out = String::from(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
+ <benchmarks library=\"quick-xml\">\n",
+ );
+
+ if true {
+ let buffer = fs::read("../../dat/yellowstone.osm").expect("Failed to read file");
+ bench!(count_highway_crossings, buffer, out);
+ bench!(count_highway_crossings_cheat_and_early_out, buffer, out);
+ }
+
+ if true {
+ let buffer = fs::read("../../dat/PMC176545.xml").expect("Failed to read file");
+ bench!(pubmed_len, buffer, out);
+ bench!(pubmed_len_with_entities, buffer, out);
+ }
+
+ out.push_str("</benchmarks>\n\n");
+ std::fs::write("benchmark-results.xml", out).unwrap();
+}
+