1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Add a benchmark

This commit is contained in:
Emil Ernerfeldt
2020-05-20 21:20:39 +02:00
parent 896d87c804
commit 7a9fb94029
4 changed files with 345 additions and 28 deletions

View File

@@ -11,3 +11,10 @@ parking_lot = "0.10"
rusttype = "0.9"
serde = "1"
serde_derive = "1"
[dev-dependencies]
criterion = "0.3"
[[bench]]
name = "benchmark"
harness = false

View File

@@ -0,0 +1,23 @@
use criterion::{criterion_group, criterion_main, Criterion};
pub fn criterion_benchmark(c: &mut Criterion) {
let mut example_app = emigui::examples::ExampleApp::default();
let mut ctx = emigui::Context::new(1.0);
let raw_input = emigui::RawInput {
screen_size: emigui::vec2(1280.0, 1024.0),
..Default::default()
};
c.bench_function("example_app", |b| {
b.iter(|| {
ctx.begin_frame(raw_input.clone());
let mut ui = ctx.fullscreen_ui();
example_app.ui(&mut ui);
ctx.end_frame()
})
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);