perf: rebuild the waiting tree only when the boot changed

The screen keeps the projected tree, milestones and tally and rebuilds them
after boot changes, or every 100 ms so finished units still fade on time.
Release, 200 units, under load: a frame from the cached projection costs
30-40% of a full frame (0.35-0.53 ms against 1.2-1.9 ms).
This commit is contained in:
Willem Vanhulle committed 2026-10-21 13:24:35 +02:00
1 parent 092ed41ffb
commit 552d1170ed
7 files changed
+107 -31

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
use std::time::Duration;
use super::{BootState, MilestoneRow, Tally, TreeNode};
#[derive(Clone, Debug)]
pub struct BootProjection {
pub forest: Vec<TreeNode>,
pub milestones: Vec<MilestoneRow>,
pub tally: Tally,
}
impl BootState {
#[must_use]
pub fn project(&self, finished_since: Duration) -> BootProjection {
BootProjection {
forest: self.waiting_forest(finished_since),
milestones: self.milestones(),
tally: self.tally(),
}
}
}