Skip to content

bench: a DEEP navigation-stack stress oscillator - #176

Merged
GLinnik21 merged 1 commit into
mainfrom
bench/deep-stack
Sep 19, 2026
Merged

GLinnik21 merged 1 commit into
mainfrom
bench/deep-stack

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Summary

Adds a third stress bench, DeepBench, alongside the existing PushBench/ModalBench
counted stress oscillators. Unlike those two, which round-trip between depth 1 and 2 every
cycle, DeepBench pushes depth pages (default 100, trigger
plxnative-deepbench[=<depth>[,<ratingKey>]]) with no pop in between, then pops all the
way back to the root one page at a time — 2*depth steps total — so the harness can grade
whether transition cost or memory holds flat as the real nav stack goes ninety-plus entries
deep, not just the shallow churn PushBench measures.

  • rust-modules/src/dev/scenarios/bench.rs: DeepDir, deep_step (pure helper deriving
    direction and stack depth from the cycle index), DeepBench, 5 unit tests.
  • rust-modules/src/dev/scenarios.rs: the trigger, tick/open/close wiring.
  • rust-modules/src/app/{boot,run}.rs: wiring into the app.
  • tests/run.py: parse_deep_bench/grade_deep_bench, dispatched when scene["bench"] == "deep".
  • tests/manifest.json: the deep-100 scene.
  • tests/test_harness.py: 10 new tests (parser, a healthy pass, and each fail condition).
  • docs/agent-reference.md: the stress-family sentence and trigger list gain DeepBench.

Why Library is excluded from the push rotation

DeepBench's push rotation is Detail/Person only — Library is deliberately never pushed.
Reading ui/containers/stack.rs shows NavStack's logical entry list is unbounded (only the
mounted body count is capped, via NavStack::evict()), but NavOp::SelectTab — Library's
only production entry point (nav_tab -> nav_peer) — retires every entry above the root and
mints at most one new entry over it: a peer swap, not a push. A monotonic push rotation
through Library would therefore collapse the very depth this bench exists to build. That
reasoning (and the fallback: Person re-pushes Detail, never Library, when no cast data has
landed yet) is documented in bench.rs's module doc and comments.

Device baseline (already measured on the TV, at main's build)

The deep-100 scene ran 200/200 steps: 180 steps over 20 ms, p50 28.3 ms, p95 41.5 ms, max
88.8 ms (the cold first Detail open). Frame cost does not grow with depth — 23/24/23/22
steps over budget per depth band on push, 22/21/23/21 on pop — and crossing the
16-mounted-body eviction boundary shows no step change. Memory falls while deep, then ends
11.9 MB above the depth-10 baseline after a full unwind. A later run on a separate
performance-investigation branch measured 120/200 steps over budget and 33.7 MB of root
growth on a different build.

The scene's ceilings in tests/manifest.json are first guesses and currently fail against
that baseline.
That is deliberate, the same way push-100/modal-100 shipped with
first-guess ceilings before their own device baselines existed: the ceilings describe the
target the bench holds the app to, and the failures are tracked as follow-up work, not as a
reason to loosen the gate.

Gates run (all green, on the committed tree, in this order)

  • cargo +nightly test --manifest-path rust-modules/Cargo.toml --lib — 3884 passed, 0
    failed, 1 ignored (includes the 5 new bench.rs unit tests).
  • python3 -m unittest test_harness from tests/ — 333 passed, OK (one pre-existing
    quarantined flow unrelated to this change: 12-filmography-detail-return, quarantined for
    an unrelated encoder limitation).
  • CARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml --lib --no-default-features — clean.
  • make check — host suite + lint gate, clean.
  • make — the ARM cross-build, clean.

Rebased onto origin/main (b2559855) cleanly; no conflicts in tests/run.py or
tests/test_harness.py despite the recent test-file-split work there.

A doc-claim-auditor pass against the diff found zero contradictions in project prose.

🤖 Generated with Claude Code

Adds a third stress bench, DeepBench (/tmp/plxnative-deepbench[=<depth>[,<ratingKey>]],
default depth 100), alongside PushBench/ModalBench. Unlike those two round-tripping
oscillators, DeepBench pushes `depth` pages with no pop in between (rotating Detail/Person
only — see below), then pops all the way back to the root one page at a time, so the
harness can grade whether transition cost or memory holds flat as the real nav stack goes
ninety-plus entries deep, not just the shallow depth-1<->2 churn PushBench measures. Each
push/pop is one Start/Settle pair, reusing BenchClock/bench_advance unchanged with
n = 2*depth; a new pure helper `deep_step` derives direction and stack depth from the cycle
index.

Nav-stack finding (as directed, driven through honestly rather than guessed at): reading
ui/containers/stack.rs shows NavStack's logical entry list is unbounded (depth() has no
cap) — only the MOUNTED body count is capped at CAP=16 via NavStack::evict(), which
unmounts (tears down Screen, delivers Unmount) the oldest live body below the top while
retaining its Entry (id/arg/ReturnState), so a Pop past CAP remounts from that retained
state rather than hitting a wall. Separately, NavOp::SelectTab (what Library's only
production entry point, nav_tab -> nav_peer, uses) retires every entry above the root and
mints at most one new entry over it — a peer swap, not a push. That makes Library unsafe
for a monotonic push rotation (unlike PushBench, which is free to use it because it
round-trips to depth 1 every cycle regardless), so DeepBench's push rotation is Detail/
Person only, with Person falling back to re-pushing Detail (not Library) when no cast data
has landed yet. Both findings are logged at runtime and documented in bench.rs.

Grading: tests/run.py gains parse_deep_bench/grade_deep_bench (dispatched by
scene["bench"] == "deep") alongside the existing grade_bench — FAIL unless all 2*depth
steps and the done line land; per-step worst_ms <= bench_worst_ms; push and pop drift
(first-10 vs last-10) <= bench_drift_ms; a new bench_depth_rss_kb gate (default 16384) on
RSS growth from step 10 to max depth; bench_rss_growth_kb on RSS growth from step 10 to the
final root RSS. New tests/manifest.json scene deep-100 (tier ui, bench: deep) carries
first-guess ceilings pending a device baseline, same as push-100/modal-100 did.

Tests: 5 new bench.rs unit tests (fake-clock: step count, push/pop trajectory, rotation,
Library exclusion, no-ratingKey zero-cycles run) plus 10 new test_harness.py tests
(parser, a healthy pass, and each fail condition: missing steps, missing done line, a slow
step, push drift, pop drift, depth-RSS growth, root-RSS growth, plus a manifest shape
check). docs/agent-reference.md's STRESS family sentence and trigger list gain deepbench/
bench_depth_rss_kb.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 19, 2026 21:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@GLinnik21
GLinnik21 merged commit cdc831a into main Sep 19, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the bench/deep-stack branch September 19, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants