Clean up benchmarks
This commit is contained in:
parent
f6770f0183
commit
44869a6718
1 changed files with 15 additions and 35 deletions
|
@ -10,7 +10,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
let mut demo_windows = egui_demo_lib::DemoWindows::default();
|
let mut demo_windows = egui_demo_lib::DemoWindows::default();
|
||||||
|
|
||||||
// The most end-to-end benchmark.
|
// The most end-to-end benchmark.
|
||||||
c.bench_function("demo_windows_minimal with tesselation (realistic)", |b| {
|
c.bench_function("demo_with_tesselate__realistic", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
ctx.begin_frame(raw_input.clone());
|
ctx.begin_frame(raw_input.clone());
|
||||||
demo_windows.ui(&ctx);
|
demo_windows.ui(&ctx);
|
||||||
|
@ -19,53 +19,33 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
c.bench_function("demo_windows_minimal_no_tesselation", |b| {
|
c.bench_function("demo_no_tesselate", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
ctx.begin_frame(raw_input.clone());
|
ctx.begin_frame(raw_input.clone());
|
||||||
demo_windows.ui(&ctx);
|
demo_windows.ui(&ctx);
|
||||||
ctx.end_frame()
|
ctx.end_frame()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let mut ctx = egui::CtxRef::default();
|
|
||||||
ctx.memory().set_everything_is_visible(true); // give us everything
|
|
||||||
let mut demo_windows = egui_demo_lib::DemoWindows::default();
|
|
||||||
|
|
||||||
c.bench_function("demo_windows_full", |b| {
|
|
||||||
b.iter(|| {
|
|
||||||
ctx.begin_frame(raw_input.clone());
|
|
||||||
demo_windows.ui(&ctx);
|
|
||||||
ctx.end_frame()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let mut ctx = egui::CtxRef::default();
|
|
||||||
// ctx.memory().set_everything_is_visible(true); // give us everything
|
|
||||||
let mut demo_windows = egui_demo_lib::DemoWindows::default();
|
|
||||||
ctx.begin_frame(raw_input.clone());
|
ctx.begin_frame(raw_input.clone());
|
||||||
demo_windows.ui(&ctx);
|
demo_windows.ui(&ctx);
|
||||||
let (_, shapes) = ctx.end_frame();
|
let (_, shapes) = ctx.end_frame();
|
||||||
|
c.bench_function("demo_only_tessellate", |b| {
|
||||||
c.bench_function("demo_windows_minimal_tessellate", |b| {
|
|
||||||
b.iter(|| ctx.tessellate(shapes.clone()))
|
b.iter(|| ctx.tessellate(shapes.clone()))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if false {
|
||||||
let mut ctx = egui::CtxRef::default();
|
let mut ctx = egui::CtxRef::default();
|
||||||
ctx.begin_frame(raw_input);
|
ctx.memory().set_everything_is_visible(true); // give us everything
|
||||||
egui::CentralPanel::default().show(&ctx, |ui| {
|
let mut demo_windows = egui_demo_lib::DemoWindows::default();
|
||||||
c.bench_function("label", |b| {
|
c.bench_function("demo_full_no_tesselate", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
ui.label(LOREM_IPSUM_LONG);
|
ctx.begin_frame(raw_input.clone());
|
||||||
})
|
demo_windows.ui(&ctx);
|
||||||
});
|
ctx.end_frame()
|
||||||
|
})
|
||||||
});
|
});
|
||||||
let _ = ctx.end_frame();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -77,17 +57,17 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
egui::FontDefinitions::default(),
|
egui::FontDefinitions::default(),
|
||||||
);
|
);
|
||||||
let font = &fonts[text_style];
|
let font = &fonts[text_style];
|
||||||
c.bench_function("text layout (uncached)", |b| {
|
c.bench_function("text_layout_uncached", |b| {
|
||||||
b.iter(|| font.layout_multiline(LOREM_IPSUM_LONG.to_owned(), wrap_width))
|
b.iter(|| font.layout_multiline(LOREM_IPSUM_LONG.to_owned(), wrap_width))
|
||||||
});
|
});
|
||||||
c.bench_function("text layout (cached)", |b| {
|
c.bench_function("text_layout_cached", |b| {
|
||||||
b.iter(|| fonts.layout_multiline(text_style, LOREM_IPSUM_LONG.to_owned(), wrap_width))
|
b.iter(|| fonts.layout_multiline(text_style, LOREM_IPSUM_LONG.to_owned(), wrap_width))
|
||||||
});
|
});
|
||||||
|
|
||||||
let galley = font.layout_multiline(LOREM_IPSUM_LONG.to_owned(), wrap_width);
|
let galley = font.layout_multiline(LOREM_IPSUM_LONG.to_owned(), wrap_width);
|
||||||
let mut tessellator = egui::epaint::Tessellator::from_options(Default::default());
|
let mut tessellator = egui::epaint::Tessellator::from_options(Default::default());
|
||||||
let mut mesh = egui::epaint::Mesh::default();
|
let mut mesh = egui::epaint::Mesh::default();
|
||||||
c.bench_function("tessellate text", |b| {
|
c.bench_function("tessellate_text", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let fake_italics = false;
|
let fake_italics = false;
|
||||||
tessellator.tessellate_text(
|
tessellator.tessellate_text(
|
||||||
|
|
Loading…
Reference in a new issue