Add benchmark of ui.label

This is to help evaluate the impact of
https://github.com/emilk/egui/pull/302
This commit is contained in:
Emil Ernerfeldt 2021-04-18 10:24:31 +02:00
parent c69ecfe421
commit c07f439b28

View file

@ -48,6 +48,22 @@ pub fn criterion_benchmark(c: &mut Criterion) {
});
}
{
let mut ctx = egui::CtxRef::default();
ctx.begin_frame(raw_input.clone());
let mut ui = egui::Ui::__test();
c.bench_function("label &str", |b| {
b.iter(|| {
ui.label("the quick brown fox jumps over the lazy dog");
})
});
c.bench_function("label format!", |b| {
b.iter(|| {
ui.label(format!("the quick brown fox jumps over the lazy dog"));
})
});
}
{
let pixels_per_point = 1.0;
let wrap_width = 512.0;