From 1f5c517c5701bf3ff9f8ccf1eda93c7f3d96e769 Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Tue, 16 Jul 2024 09:47:29 +0100 Subject: [PATCH] color benchmark output based on time compared to arrow --- bench-vortex/src/bin/tpch_benchmark.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/bench-vortex/src/bin/tpch_benchmark.rs b/bench-vortex/src/bin/tpch_benchmark.rs index 1e2198d026..e250a100cc 100644 --- a/bench-vortex/src/bin/tpch_benchmark.rs +++ b/bench-vortex/src/bin/tpch_benchmark.rs @@ -17,8 +17,8 @@ async fn main() { // The formats to run against (vs the baseline) let formats = [ - Format::Csv, Format::Arrow, + Format::Csv, Format::Vortex { disable_pushdown: false, }, @@ -56,6 +56,8 @@ async fn main() { let query = tpch_query(i); let mut cells = Vec::with_capacity(formats.len()); cells.push(Cell::new(&format!("Q{}", i))); + + let mut elapsed_us = Vec::new(); for (ctx, format) in ctxs.iter().zip(formats.iter()) { let start = SystemTime::now(); ctx.sql(&query) @@ -67,8 +69,25 @@ async fn main() { .map_err(|e| println!("Failed to collect {} {:?}: {}", i, format, e)) .unwrap(); let elapsed = start.elapsed().unwrap(); + elapsed_us.push(elapsed); progress.inc(1); - cells.push(Cell::new(&format!("{} us", elapsed.as_micros()))); + } + + let baseline = elapsed_us.first().unwrap(); + // yellow: 10% slower than baseline + let yellow = baseline.as_micros() + (baseline.as_micros() / 10); + // red: 50% slower than baseline + let red = baseline.as_micros() + (baseline.as_micros() / 50); + cells.push(Cell::new(&format!("{} us", baseline.as_micros())).style_spec("b")); + for measure in elapsed_us.iter().skip(1) { + let style_spec = if measure.as_micros() > red { + "bBr" + } else if measure.as_micros() > yellow { + "bFdBy" + } else { + "bFdBG" + }; + cells.push(Cell::new(&format!("{} us", measure.as_micros())).style_spec(style_spec)); } table.add_row(Row::new(cells)); }