diff --git a/examples/benchmark.rs b/examples/benchmark.rs new file mode 100644 index 0000000..24a5d2c --- /dev/null +++ b/examples/benchmark.rs @@ -0,0 +1,25 @@ +use std::sync::Arc; + +use osui::prelude::*; + +pub fn main() { + let engine = Benchmark::new(Console::new()); + let mut benchmark_result = Vec::new(); + + for items in 0..10 { + benchmark_result.push( + engine + .run(move |cx| { + rsx! { + for _ in (0..items) { + "Hello, world!" + } + } + .view(cx.clone()) + }) + .expect("Failed to run engine"), + ); + } + + println!("{benchmark_result:?}"); +} diff --git a/macros/src/emit.rs b/macros/src/emit.rs index 6ad9c85..f41e3bc 100644 --- a/macros/src/emit.rs +++ b/macros/src/emit.rs @@ -104,6 +104,7 @@ fn emit_node_scope(node: &RsxNode) -> TokenStream { quote! { { #deps_emit + #[allow(unused_parens)] r.dynamic_scope(move |scope| { scope.children.lock().unwrap().clear(); for #pat in #expr {