From f9c4be33a722408d72e24d610745649742624ae1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 29 Mar 2021 22:48:13 +0200 Subject: [PATCH] Add a realistic end-to-end benchmark --- egui_demo_lib/benches/benchmark.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/egui_demo_lib/benches/benchmark.rs b/egui_demo_lib/benches/benchmark.rs index 7ae03213..1390ca43 100644 --- a/egui_demo_lib/benches/benchmark.rs +++ b/egui_demo_lib/benches/benchmark.rs @@ -9,7 +9,17 @@ pub fn criterion_benchmark(c: &mut Criterion) { let mut ctx = egui::CtxRef::default(); let mut demo_windows = egui_demo_lib::DemoWindows::default(); - c.bench_function("demo_windows_minimal", |b| { + // The most end-to-end benchmark. + c.bench_function("demo_windows_minimal with tesselation (realistic)", |b| { + b.iter(|| { + ctx.begin_frame(raw_input.clone()); + demo_windows.ui(&ctx); + let (_, shapes) = ctx.end_frame(); + ctx.tessellate(shapes) + }) + }); + + c.bench_function("demo_windows_minimal (no tesselation)", |b| { b.iter(|| { ctx.begin_frame(raw_input.clone()); demo_windows.ui(&ctx);