Benchmarking
This commit is contained in:
+24
-2
@@ -4,12 +4,34 @@ use osui::prelude::*;
|
||||
|
||||
pub fn main() {
|
||||
let engine = Benchmark::new(Console::new());
|
||||
engine.run(app).expect("Failed to run engine");
|
||||
|
||||
let mut benchmark_result = Vec::new();
|
||||
|
||||
for flat in 0..10 {
|
||||
// for nest in 0..10 {
|
||||
benchmark_result.push(
|
||||
engine
|
||||
.run(move |cx| {
|
||||
// let sync_nest = use_state(nest);
|
||||
cx.scope().child(app, None);
|
||||
// use_sync_effect(cx, &sync_nest, |s| s.get_dl(), &[&sync_nest]);
|
||||
|
||||
rsx! {
|
||||
app
|
||||
}
|
||||
.view(cx.clone())
|
||||
})
|
||||
.expect("Failed to run engine"),
|
||||
);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
fn app(cx: &Arc<Context>) -> View {
|
||||
// let nest = use_sync_state(cx, 0, |v| *v);
|
||||
|
||||
rsx! {
|
||||
"Hello, world!"
|
||||
"hello_world"
|
||||
}
|
||||
.view(cx.clone())
|
||||
}
|
||||
|
||||
@@ -3,8 +3,13 @@ use std::sync::Arc;
|
||||
use osui::prelude::*;
|
||||
|
||||
pub fn main() {
|
||||
let engine = SimpleBenchmark::new(Console::new());
|
||||
engine.run(app).expect("Failed to run engine");
|
||||
let engine = Benchmark::new(Console::new());
|
||||
let benchmark_result = engine.run(app).expect("Failed to run engine");
|
||||
println!("Avg: {} μs", benchmark_result.average);
|
||||
println!("Min: {} μs", benchmark_result.min);
|
||||
println!("Max: {} μs", benchmark_result.max);
|
||||
println!("Tot: {} μs", benchmark_result.total);
|
||||
println!("Tot Render: {} μs", benchmark_result.total_render);
|
||||
}
|
||||
|
||||
fn app(cx: &Arc<Context>) -> View {
|
||||
|
||||
Reference in New Issue
Block a user