Prune commentary and stale Rust port notes

This commit is contained in:
iris committed 2026-09-10 00:44:13 -04:00
1 parent 5428cd75c9
commit 25370731d0
193 files changed
+693 -16219

No files matched your search

+3 -51
View File
@@ -1,51 +1,17 @@
//! What each GPU arena costs to upload per frame, at layer 1 (docs/RUST.md's
//! "Three test layers") -- the real transcript screen over the real bench
//! fixture, with no window, no compositor and no GPU.
//!
//! cargo test --release --test arena_churn -- --ignored --nocapture
//!
//! from `scripts/rigs/ui-profile/`.
//!
//! It exists because the upload is the one part of a frame that layer 1
//! *builds* and never performs, so `frame_profile.rs` cannot see it at
//! all: the emulator's `stream: build p50` stayed at 10.5ms across a
//! change that nearly halved layer 1's CPU frame, and nothing could say
//! why until this could count bytes.
//!
//! Three numbers per array per frame, which is the point of the rig --
//! any two of them alone are misleading:
//!
//! - **changed** is the floor: entries whose bytes actually differ from
//! the previous frame, found by diffing. Nothing correct can upload
//! less.
//! - **uploaded** is what `iris` really writes, read from the same
//! `Dirty` sets `UiRenderNode::update` consumes and cleared here the
//! way an upload would clear them. Above `changed` by whatever the
//! marking over-marks plus whatever range coalescing pulls in.
//! - **whole** is what the old code wrote every time anything changed.
//!
//! `#[ignore]`d and assertion-free: it prints distributions, so
//! `run-tests.sh` neither runs it nor can fail on it.
use ai_app::ui::fixture::{PHONE_FRAME_MS, PHONE_SCALE, phone_size};
use iris::harness::Harness;
use iris::prelude::{GlyphPrimitive, Primitive, RectPrimitive};
use iris::widget::Scrollable;
use ui_profile::stats::pct_u64;
/// Passes over the same content, alternating direction -- the same
/// out-and-back `frame_profile.rs`'s fling drives, so the two rigs
/// describe the same gesture.
const PASSES: usize = 8;
const VELOCITY: f32 = 12_000.0;
const PASS_CAP_MS: u64 = 4_000;
/// One array's per-frame totals.
#[derive(Default)]
struct Tally {
name: &'static str,
stride: usize,
/// The previous frame's bytes, for the diff that finds the floor.
prev: Vec<u8>,
changed: Vec<u64>,
uploaded: Vec<u64>,
@@ -62,7 +28,6 @@ impl Tally {
}
}
/// Records one frame, and clears the dirty set as an upload would.
fn frame(&mut self, bytes: &[u8], ranges: Vec<std::ops::Range<usize>>) {
let n = self.prev.len().min(bytes.len()) / self.stride;
let mut changed = (0..n)
@@ -71,8 +36,6 @@ impl Tally {
self.prev[r.clone()] != bytes[r]
})
.count();
// Everything past the old end is new, and so is dirty by
// definition.
changed += bytes.len() / self.stride - n;
self.changed.push((changed * self.stride) as u64);
self.uploaded
@@ -85,11 +48,8 @@ impl Tally {
fn report(&mut self) {
let sum = |v: &[u64]| v.iter().sum::<u64>();
let (changed, uploaded, whole) = (
sum(&self.changed),
sum(&self.uploaded),
sum(&self.whole),
);
let (changed, uploaded, whole) =
(sum(&self.changed), sum(&self.uploaded), sum(&self.whole));
println!(
" {:<10} whole {:>7.1} MB | uploaded {:>7.1} MB ({:>5.1}%) | floor {:>7.1} MB ({:>5.1}%)",
self.name,
@@ -114,9 +74,6 @@ impl Tally {
}
}
/// The three arenas a transcript frame writes. Masks and move offsets are
/// left out deliberately: they are a hundred-odd entries, so their whole
/// buffer is smaller than one range of any of these.
struct Arenas {
instances: Tally,
rects: Tally,
@@ -132,15 +89,11 @@ impl Arenas {
}
}
/// Reads this frame's dirty ranges out of the render state and clears
/// them, exactly as `UiRenderNode::update` would on a real backend.
fn frame(&mut self, h: &mut Harness) {
let count = h.render.primitives.instances().len();
let (entries, dirty) = h.render.primitives.instances_for_upload();
// `PrimitiveInstance` is not exported, so the stride comes from
// the slice rather than from `size_of`.
let bytes: Vec<u8> = bytemuck::cast_slice(entries).to_vec();
self.instances.stride = if count == 0 { 48 } else { bytes.len() / count };
self.instances.stride = bytes.len().checked_div(count).unwrap_or(48);
let ranges = dirty.ranges(count, 1024 / self.instances.stride);
dirty.clear();
self.instances.frame(&bytes, ranges);
@@ -196,7 +149,6 @@ fn what_a_fling_uploads() {
break;
}
}
// A moment at rest between passes, as a finger would leave.
t += 200;
}
println!("\na fling, {PASSES} passes:");