StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.
| 1 | // Benchmarks for layout engine |
| 2 | |
| 3 | use criterion::{black_box, criterion_group, criterion_main, Criterion}; |
| 4 | |
| 5 | // Replace this with real layout engine benchmarks once available. |
| 6 | fn bench_layout_basic(c: &mut Criterion) { |
| 7 | c.bench_function("layout_basic_compute", |b| { |
| 8 | b.iter(|| { |
| 9 | // Simulate a small layout computation workload |
| 10 | let mut acc = 0.0_f32; |
| 11 | for i in 0..1024 { |
| 12 | // black_box to avoid compiler optimizing the loop away |
| 13 | acc += (black_box(i as f32).sin() * 0.5 + 0.5) * 3.14159; |
| 14 | } |
| 15 | black_box(acc); |
| 16 | }) |
| 17 | }); |
| 18 | } |
| 19 | |
| 20 | criterion_group!(benches, bench_layout_basic); |
| 21 | criterion_main!(benches); |
| 22 |