From fbc903fa6a8f6a20db8478db2d73986a0c37ce70 Mon Sep 17 00:00:00 2001 From: noah Date: Thu, 15 Oct 2026 20:19:18 -0600 Subject: [PATCH] Benchmark health diagnostics on representative miners --- crates/alkane-gui/src/model.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/crates/alkane-gui/src/model.rs b/crates/alkane-gui/src/model.rs index f5380929..44ede9df 100644 --- a/crates/alkane-gui/src/model.rs +++ b/crates/alkane-gui/src/model.rs @@ -2604,6 +2604,38 @@ mod tests { assert!(per.as_millis() < 100, "cell rendering regressed: {per:?}"); } + /// Microbenchmark: component health scores and operator-facing diagnostics + /// recomputed when scan results refresh the table. + #[test] + #[ignore] + fn bench_health_diagnostics() { + use std::hint::black_box; + use std::time::Instant; + + let rows = bench_fleet(); + let iters = 1000u32; + let start = Instant::now(); + let mut sink = 0usize; + for _ in 0..iters { + for row in &rows { + for facet in [ + HealthFacet::Overall, + HealthFacet::Power, + HealthFacet::Fans, + HealthFacet::Boards, + ] { + sink += black_box(row.health_score(facet)) as usize; + } + sink += row.health_summary().len(); + sink += row.health_tooltips(4, 3).iter().map(String::len).sum::(); + } + } + black_box(sink); + let per = start.elapsed() / iters; + println!("bench_health_diagnostics: {} rows = {:?}/refresh", rows.len(), per); + assert!(per.as_millis() < 20, "health diagnostics regressed: {per:?}/refresh"); + } + #[test] fn selection_survives_upsert() { let mut rows = bench_fleet();