1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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();
}
|