Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
crates/strato-core/benches/layout.rs
1// Benchmarks for layout engine
2 
3use criterion::{black_box, criterion_group, criterion_main, Criterion};
4 
5// Replace this with real layout engine benchmarks once available.
6fn 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 
20criterion_group!(benches, bench_layout_basic);
21criterion_main!(benches);
22