diff options
Diffstat (limited to 'benchmarks/quick-xml/src/main.rs')
| -rw-r--r-- | benchmarks/quick-xml/src/main.rs | 39 |
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(); +} + |
