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:
parent
c69ecfe421
commit
c07f439b28
1 changed files with 16 additions and 0 deletions
|
@ -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 pixels_per_point = 1.0;
|
||||||
let wrap_width = 512.0;
|
let wrap_width = 512.0;
|
||||||
|
|
Loading…
Reference in a new issue