diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-10-23 14:52:06 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-10-23 14:52:06 +0200 |
commit | b1b3fe58eb18520c5ce86c2938fb3dc2ac292f23 (patch) | |
tree | 3a00a9569a37d84ff067cf669a383aeaa7b099be | |
parent | 5bfe77d93315111f80e3b56aee929fc33a14cf1f (diff) | |
download | evtclib-b1b3fe58eb18520c5ce86c2938fb3dc2ac292f23.tar.gz evtclib-b1b3fe58eb18520c5ce86c2938fb3dc2ac292f23.tar.bz2 evtclib-b1b3fe58eb18520c5ce86c2938fb3dc2ac292f23.zip |
add a benchmark for evtclib::process
-rw-r--r-- | benches/parsing_benchmark.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/benches/parsing_benchmark.rs b/benches/parsing_benchmark.rs index e245f77..1e81e3c 100644 --- a/benches/parsing_benchmark.rs +++ b/benches/parsing_benchmark.rs @@ -55,9 +55,25 @@ fn unzipped_qadim_benchmark(c: &mut Criterion) { }); } +/// This benchmark tests the performance of process on a pre-parsed log. +/// +/// This is important because it is the point where we can change the most. Parsing the input file +/// is a lot of bit-twiddling and there's probably not a lot of performance that we can gain +/// (especially in the case where I/O slowdown is minimal), but when going from a RawEvtc to a Log, +/// it is the first time that we actually do some work in converting all of the values from +/// low-level to high-level. +fn process_qadim(c: &mut Criterion) { + let file = io::BufReader::new(fs::File::open(QADIM_LOG).unwrap()); + let raw_evtc = evtclib::raw::parse_zip(file).unwrap(); + + c.bench_function("process Qadim", |b| { + b.iter(|| evtclib::process(&raw_evtc).unwrap()) + }); +} + criterion_group! { name = benches; config = Criterion::default().sample_size(30); - targets = zipped_qadim_benchmark, zipped_qadim_ram_benchmark, unzipped_qadim_benchmark + targets = zipped_qadim_benchmark, zipped_qadim_ram_benchmark, unzipped_qadim_benchmark, process_qadim } criterion_main!(benches); |