Skip to content

Commit e2ef1c8

Browse files
Added a comparison table on cli output
1 parent 4cb06f9 commit e2ef1c8

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

benchmark/src/main.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,45 @@ async fn main() -> Result<()> {
190190
std::process::exit(1);
191191
}
192192

193+
// Print comparison table
194+
println!("\n═══════════════════════════════════════════════════════════════");
195+
println!(" COMPARISON TABLE");
196+
println!("═══════════════════════════════════════════════════════════════");
197+
println!(
198+
"{:<25} {:>12} {:>12} {:>10}",
199+
"Query", "DuckDB (ms)", "DataFusion", "Ratio"
200+
);
201+
println!("───────────────────────────────────────────────────────────────");
202+
203+
for r in &all_results {
204+
let ratio = r.datafusion.avg_ms / r.duckdb.avg_ms;
205+
let winner = if ratio < 1.0 {
206+
"◀"
207+
} else {
208+
""
209+
};
210+
println!(
211+
"{:<25} {:>12.2} {:>12.2} {:>8.2}x {}",
212+
&r.query_name[..r.query_name.len().min(25)],
213+
r.duckdb.avg_ms,
214+
r.datafusion.avg_ms,
215+
ratio,
216+
winner
217+
);
218+
}
219+
220+
println!("───────────────────────────────────────────────────────────────");
221+
222+
// Calculate totals
223+
let total_duckdb: f64 = all_results.iter().map(|r| r.duckdb.avg_ms).sum();
224+
let total_datafusion: f64 = all_results.iter().map(|r| r.datafusion.avg_ms).sum();
225+
let total_ratio = total_datafusion / total_duckdb;
226+
227+
println!(
228+
"{:<25} {:>12.2} {:>12.2} {:>8.2}x",
229+
"TOTAL", total_duckdb, total_datafusion, total_ratio
230+
);
231+
193232
// Generate report
194233
report::generate(&args.output, &all_results)?;
195234
println!("\n═══════════════════════════════════════════════════════════════");

0 commit comments

Comments
 (0)