Spike, not the final UI: it answers whether flare-ui can drive Alkane OS's on-box pages, and what it costs. What works: - schema/alkane-bb.json authors the sidebar as data (3 sections, 14 tabs); - src/bin/ui-spike.rs renders it through flare_ui::nav + flare_ui::shell, so the unified sidebar, ordering and surface filtering come from the schema rather than from hand-written HTML; - the render uses the shared bf- design tokens, the same ones the rest of the suite uses. Size, measured rather than assumed (armv7, release, stripped): ui-baseline 323 KiB (maud + serde_json, no flare-ui) ui-spike 771 KiB (flare-ui + wschema + sha2) marginal 448 KiB Vendoring: third-party/flare-ui is the full v0.2.9 tree pinned in flare-ui/flare-ui.lock (a partial archive does not compile, since the crate include_str!s assets from dash-editor/). vendor/ is re-generated as a cargo directory source with the new registry dependencies (maud, sha2, typenum, digest, generic-array, block-buffer, crypto-common, cfg-if, etc.) so the build still works offline. third-party/README.md records how to re-pin.
114 lines
2.6 KiB
Rust
114 lines
2.6 KiB
Rust
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
|
use itertools::Itertools;
|
|
|
|
// approximate 100_000 iterations for each combination
|
|
const N1: usize = 100_000;
|
|
const N2: usize = 448;
|
|
const N3: usize = 86;
|
|
const N4: usize = 41;
|
|
|
|
fn tuple_comb_for1(c: &mut Criterion) {
|
|
c.bench_function("tuple comb for1", move |b| {
|
|
b.iter(|| {
|
|
for i in 0..N1 {
|
|
black_box(i);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
fn tuple_comb_for2(c: &mut Criterion) {
|
|
c.bench_function("tuple comb for2", move |b| {
|
|
b.iter(|| {
|
|
for i in 0..N2 {
|
|
for j in (i + 1)..N2 {
|
|
black_box(i + j);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
fn tuple_comb_for3(c: &mut Criterion) {
|
|
c.bench_function("tuple comb for3", move |b| {
|
|
b.iter(|| {
|
|
for i in 0..N3 {
|
|
for j in (i + 1)..N3 {
|
|
for k in (j + 1)..N3 {
|
|
black_box(i + j + k);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
fn tuple_comb_for4(c: &mut Criterion) {
|
|
c.bench_function("tuple comb for4", move |b| {
|
|
b.iter(|| {
|
|
for i in 0..N4 {
|
|
for j in (i + 1)..N4 {
|
|
for k in (j + 1)..N4 {
|
|
for l in (k + 1)..N4 {
|
|
black_box(i + j + k + l);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
fn tuple_comb_c1(c: &mut Criterion) {
|
|
c.bench_function("tuple comb c1", move |b| {
|
|
b.iter(|| {
|
|
for (i,) in (0..N1).tuple_combinations() {
|
|
black_box(i);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
fn tuple_comb_c2(c: &mut Criterion) {
|
|
c.bench_function("tuple comb c2", move |b| {
|
|
b.iter(|| {
|
|
for (i, j) in (0..N2).tuple_combinations() {
|
|
black_box(i + j);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
fn tuple_comb_c3(c: &mut Criterion) {
|
|
c.bench_function("tuple comb c3", move |b| {
|
|
b.iter(|| {
|
|
for (i, j, k) in (0..N3).tuple_combinations() {
|
|
black_box(i + j + k);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
fn tuple_comb_c4(c: &mut Criterion) {
|
|
c.bench_function("tuple comb c4", move |b| {
|
|
b.iter(|| {
|
|
for (i, j, k, l) in (0..N4).tuple_combinations() {
|
|
black_box(i + j + k + l);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
criterion_group!(
|
|
benches,
|
|
tuple_comb_for1,
|
|
tuple_comb_for2,
|
|
tuple_comb_for3,
|
|
tuple_comb_for4,
|
|
tuple_comb_c1,
|
|
tuple_comb_c2,
|
|
tuple_comb_c3,
|
|
tuple_comb_c4,
|
|
);
|
|
criterion_main!(benches);
|