Skip to content

[lynx-perf-s3] Roadmap: retained heap, background mount CPU, and cold-path cliffs #23

Closed

Description

@Huxpro

Season-3 umbrella for the performance signals found after measuring the full S1 stack (#1 ← #10 … #15, with #22 as the stage-instrument head).

This roadmap is not a continuation of the stopped S2 transport/code-staging plan. #16/#22 showed that MT load+parse+eval, plan interpretation, instantiate expansion, and wire are too small to authorize #17–#20. The next credible work is in retained state, background materialization, and cold-path latency. Those areas are partly orthogonal to the Lynx transport and partly possible regressions introduced by S1, so this season begins with attribution rather than an optimization patch.

Rule: first locate the owner; then optimize it. No wall-clock hypothesis may open an implementation PR before the same instrument identifies the responsible stack step and cost center.

Evidence snapshot (diagnostic, not yet a gate)

The current external cross-framework latest.json snapshot reported the following on one host with one instrument. The raw file, exact runner revision/options, and host disclosure are not yet committed to this repository; S3-0 must import and reproduce them before any number below becomes a baseline.

Retained BTS heap after GC, 10k rows held

entry heap approximate per row
ReactLynx 53.0 MB 5.3 KB
Vue vdom 56.6 MB 5.7 KB
Vue vapor 99.1 MB 9.9 KB
Octane main 253.5 MB 25 KB
Octane S1 head 466.2 MB 47 KB

The 8.8× field gap is large enough to treat as P0 even though the current snapshot is n=1. The S1/main delta is a regression candidate, not an established cause. #11 is a high-signal bisection boundary because it enabled transported retained-subtree adoption with a one-predicate production change; #12 also added plan registries/instance metadata. Neither is guilty without stack-wide retained-object evidence.

create@10k CPU/wire split

entry wall BTS CPU MTS CPU wire down
ReactLynx 453 ms 67.9 ms 369 ms 1.95 MB
Vue vapor 651 ms 181 ms 469 ms 1.76 MB
Octane S1 head 1.30 s 752 ms 811 ms 3.25 MB

#16/#22 independently measured MT instantiate expansion at 2.5% of create and wire at 1.0%. That rules out the stopped S2 levers as the primary create fix. The likely owner is the background universal path: owner/component execution, universalFor item-lambda descriptor construction, universalProps/universalValue, materialization, transaction staging, cloning/freezing, and plan folding. This cost is primarily orthogonal/pre-existing—main was already slow—but the stack may have amplified it.

Cold first-use cliff

operation first sample steady median first/steady
S1 head swap@1k 182 ms 23 ms 8.0×
S1 head replace@1k 295 ms 149 ms 2.0×
main swap@1k 268 ms 79 ms 3.4×

React/Vue are approximately 1.0× in the same snapshot. This is pre-existing on main and amplified in relative terms because steady-state swap improved while first use did not. The repository's current lynx-render benchmark deliberately runs an untimed warmup and sets warmupRatio: 1, so it cannot observe this UX defect today.

Lower-priority constants

  • clear@10k: 306 ms vs React 142 ms (2.16×);
  • update10th downlink: 81.5 KB vs the field's ~47 KB layer; uplink 767 B vs 406 B;
  • updateStorm@1k: ~1.4 ms/tick vs vapor ~0.5 ms/tick.

These are real opportunities, but they do not outrank a possible 213 MB retained-heap regression, 752 ms of BTS create CPU, or a first-interaction cliff.

Storm comparison caveat

A 50-tick storm sends 51–52 commits in React/Vue but only 7 at the S1 head (main: 3). Octane's result is legal under its explicit latest-state/backpressure contract, but it skips intermediate presentation states. Every future cross-framework storm table must show commit count beside wall time. A wall-clock ratio without matched presentation semantics is informational, never an acceptance gate.

Provisional classification

signal current classification why
466 MB retained BTS heap possible S1 regression + structural baseline debt main is already ~4.8× React; S1 head is another 1.84× over main
752 ms BTS create CPU orthogonal universal-core hot path, possibly stack-amplified #22 makes wire/MT expansion too small; main already pays the model
first swap/replace cliff pre-existing cold-path defect, relatively amplified by S1 main has the cliff; S1 improves steady state more than first use
update envelope / clear / small-commit constants orthogonal lower-priority debt meaningful but below P0/P1 costs

Roadmap — one PR-sized step at a time

[lynx-perf-s3 0] Stack-wide attribution and reproducible evidence — gates every implementation below

Commit the missing observation plane under benchmarks/ and run it on the exact stack heads:

main → #1 → #10 → #11 → #12 → #13 → #14 → #15 → #22

Required metrics, from one runner and one quiet-host session:

  1. Retained heap: fresh realm, create/hold 1k/10k/30k rows, explicit GC through CDP, n≥5; report median/spread and bytes-per-row slope. Capture heap snapshots/object census/dominator paths for main and every head that changes the slope materially.
  2. Create CPU: BTS and MTS CPU plus wire bytes on the same run; add deterministic allocation/work counters for owner drafts, universalProps, universalValue, blueprint/logical records, frozen/cloned objects, commands, and plan instances.
  3. Cold vs steady: preserve sample order; report first sample, samples 2–N, first/steady ratio, and a fresh-realm repeat. Do not warm away the claim. Include swap, replace, create, clear, select, and update10th.
  4. Semantic controls: rendered checksum/identity/event success for every sample; storm rows include delivered commit count and changed-row count.
  5. Provenance: archive the original latest.json, runner SHA/options, framework bundle SHAs, host/Node/Chromium/Lynx versions, and raw samples.

Go/no-go output:

  • identify the first stack head causing ≥15% retained-heap or cold-path regression;
  • attribute ≥80% of BTS create CPU to named, non-overlapping stages/counters, leaving any remainder explicit;
  • if the original red flags do not reproduce with n≥5, stop or rewrite the affected tracks instead of preserving their targets by inertia.

[lynx-perf-s3 1] Recover any S1 retained-heap regression — P0; depends on S3-0

Open only if S3-0 finds a stack step with a material heap jump.

Investigation order:

  1. retained owner/record/props/contexts/listener dominators;
  2. transported adoption introduced at perf(octane): transported universal roots adopt retained subtrees — render breadth proportional to change size ([lynx-perf 3]) #11 (retainEligible), tested as a benchmark-only on/off counterfactual;
  3. plan registry/plan-instance/ids/values/events introduced at perf(lynx): plan-aware wire — fold provable plan instances into instantiate-by-plan-id commands ([lynx-perf 4]) #12;
  4. pacing queues, acknowledgement state, attachments, and worklet bridge only if the heap census points there.

Acceptance:

  • S1 head retained heap ≤1.10× the immediately preceding non-regressed head at 1k/10k/30k;
  • retain the measured select/update/storm wins and all adoption semantics (host identity, effects, contexts, events, reorders);
  • no “clear the cache after the benchmark” workaround: lifetime and invalidation must follow public root/owner/subtree semantics;
  • add a deterministic retained-object/allocation gate plus post-unmount cleanup proof; wall-clock heap snapshots remain informational confirmation.

If no S1 head causes the jump, close this item as not-planned and move the baseline structural debt into S3-2 rather than forcing a regression narrative.

[lynx-perf-s3 2] Background mount materialization diet — P1; depends on S3-0 and any S3-1 fix

Target the stages S3-0 proves dominant, not a preselected transport mechanism. Candidate seams to measure include:

  • universalFor item callback and keyed-path construction;
  • universalProps normalization and frozen prop programs;
  • universalValue wrappers and plan-value materialization;
  • owner draft/clone bookkeeping during initial mount;
  • blueprint → logical-record transaction staging;
  • clone/freeze/serialization work before transport;
  • plan-instance folding allocations.

Prefer compiler/runtime specialization that removes intermediate objects while preserving Blueprint/LogicalRecord/versioned-transport semantics. Do not trade retained heap for mount speed without publishing the Pareto curve.

Acceptance on the reproduced same-host matrix:

  • BTS create@10k CPU improves ≥1.5× from the post-S3-1 baseline, with a phase target ≤500 ms and a stretch target ≤400 ms;
  • total create@10k same-run ratio improves materially without regressing MTS CPU, wire bytes, FCP, update paths, or retained heap by >5%;
  • deterministic allocation counters fall in the stage the patch claims to optimize;
  • 1k/10k/30k slopes improve; no fixed-size special case for the table app.

A patch that only moves time from BTS to MTS, increases memory, or wins through fewer presented states is a NO-GO.

[lynx-perf-s3 3] Eliminate first-use reorder/rebuild cliffs — P1, independent after S3-0

First identify which boundary is cold:

  • background component/materialization path;
  • keyed/LIS reorder bookkeeping;
  • first move-command staging or receiver apply;
  • lazy module/registry initialization;
  • V8/PrimJS compilation or IC warmup;
  • capacity growth of maps/arrays/caches.

Use fresh realms and include a JIT-control run where available; do not diagnose a browser JIT artifact as framework initialization without a counterfactual. Any eager prewarm must be charged to startup/FCP and compared against lazy cost—moving the cliff earlier is not a win.

Acceptance:

  • swap@1k and replace@1k first/steady ≤1.5× or first-use excess ≤20 ms, whichever is more tolerant;
  • fresh-realm result repeats at n≥5 with spread disclosed;
  • steady-state swap/replace do not regress >5%; create/FCP and bundle budgets stay within existing gates;
  • identity/move semantics and the documented LIS contract remain unchanged (final DOM and survivor identity, not a particular physical move set).

[lynx-perf-s3 4] Structural retained-memory diet — P1/P2, only after regression recovery and create attribution

Main already retains ~25 KB/row, roughly 4.8× React in the diagnostic snapshot. After removing any S1 regression, use dominator evidence to reduce duplicated long-lived state across owner records, committed props, blueprint/logical records, listener tables, and plan instance metadata.

Acceptance is slope-based, not one 10k snapshot:

  • first milestone ≤20 KB/row at 10k/30k with no super-linear growth;
  • stretch milestone ≤15 KB/row;
  • no update/render breadth regression, no lost replay/adoption/error/Suspense semantics, and post-unmount heap returns to the established floor.

This may stack with S3-2 only if the allocation and lifetime evidence shows the same representation owns both CPU and retained heap. Otherwise keep the PR tracks separate.

[lynx-perf-s3 5] Teardown and small-commit constants — P2; last

Split rather than bundle unrelated fixes:

  • clear/remove/destroy path CPU and retained cleanup;
  • update10th envelope/encoding overhead (81.5 KB → field ~47 KB layer);
  • per-commit fixed cost at 1k.

Acceptance anchors:

  • clear@10k same-run ratio ≤1.5× React without deferred cleanup or memory retention;
  • update10th downlink ≤55 KB and uplink ≤500 B unless semantic payload differences are itemized byte-for-byte;
  • fixed per-commit CPU improves ≥30% in a semantically matched commit-count run;
  • storm reports always include commit counts; no claim based on Octane's 7 commits versus another framework's 51–52.

Dependency graph

#22 / S1 head
    ↓
S3-0 attribution
    ├── S3-1 S1 memory-regression recovery (conditional)
    │       ↓
    ├── S3-2 BG mount materialization
    ├── S3-3 cold reorder/rebuild cliff
    └── S3-4 structural retained-memory diet
            ↓
        S3-5 teardown/small constants

S3-2 and S3-3 may proceed in parallel after S3-0 if they have disjoint owners/write sets. S3-4 waits for regression recovery so a structural redesign is not used to hide a stack regression. S3-5 stays last because its wins are smaller and easier to mis-prioritize.

Working agreements

  • Stack on PR perf(lynx): attribute FCP and create stages #22 while the S1 chain is unmerged; record every measured head SHA. Rebase the chain only after the owning lower PR moves.
  • One sub-issue and one PR per checked item; S3-0 files the concrete sub-issues after its attribution table, rather than this umbrella pre-assigning causes.
  • Counters/allocation counts/bytes gate; wall-clock and heap snapshots inform. Every ratio is same-run and carries host/toolchain disclosure.
  • The same workload and semantic oracle run across all framework cells; no Octane-only easier workload.
  • Realm-safe predicates only; no cross-realm prototype/instanceof assumptions.
  • Keep the S1 wins: proportional wire, pacing, transported adoption, plan IDs, prod validation fold, protocol v2, and lazy worklet boundary. A change may revise one only with a measured regression attribution and full semantic replacement.
  • No changeset for benchmark-only attribution; user-facing runtime/compiler changes get patch changesets while Octane is 0.x.
  • Every PR reports memory, BTS CPU, MTS CPU, wire, cold/steady, and commit counts even when only one metric is its target. This prevents another locally successful diff from moving cost into an unobserved dimension.

Season success

This season succeeds if it either:

  1. identifies and removes the S1 heap regression while preserving the S1 speed wins, and materially reduces BG mount CPU plus cold first-use latency; or
  2. proves with reproducible evidence that a red flag is structural/platform-owned and closes that track without speculative code.

“More optimization PRs” is not itself success. The outcome is a smaller, faster, evidence-attributed system with no hidden memory or semantic bill.


Agent-authored roadmap derived from the post-S1 diagnostic snapshot and repository/source review. The raw external snapshot remains provisional until S3-0 archives and reproduces it.

Activity

  1. Huxpro commented on Aug 10, 2026

    @Huxpro
    OwnerAuthor

    S3-0 attribution is published as draft #25 (stacked on #22), with raw n=5 matrices and snapshot analysis in #24.

    track observed gate action
    S3-1 no retained-heap step ≥15%; cited #11 regression did not reproduce #26 closed not planned
    S3-2 #22 BTS create 880.9 ms, 2.97× Vue VDOM; named stages explain 81.8% #27, implementation PR next
    S3-3 historical #12 cold regression reproduced, but current #22 satisfies every acceptance expression #29 closed not planned
    S3-4 15,075 B/row; 20 KB milestone passes, decimal 15 KB stretch misses by 75 B/row #30, separate structural PR
    S3-5 update storm varies 5/6 commits; select storm fixed 2 commits / 3 commands #28, final stacked PR

    Exact attribution stack: cdb501c9 → e14d6001 → 34d530da → adfad409 → b4b0ab92 → dcb334af → e627ca59 → 4a53620f → 3f251a8a; S3-0 head 219bd078.

    The original diagnostic latest.json was not available in the repository, issue attachments, or local workspace. Its quoted absolute values were not substituted for the fresh measurements.

  2. Huxpro commented on Aug 10, 2026

    @Huxpro
    OwnerAuthor

    Season 3 implementation and evidence work is complete as a reviewable draft stack:

    1. bench(lynx-table): attribute S3 performance cliffs #25 — S3-0 attribution and reproducible observation plane
    2. perf(lynx): cut keyed component materialization cost #31 — S3-2 BTS materialization/runtime reduction
    3. perf(lynx): prove retained heap stretch #32 — S3-4 structural retained-heap proof
    4. perf(lynx): lock teardown and storm constants #33 — S3-5 teardown boundaries and deterministic storm constants

    Exact stack: #22 ← #25 ← #31 ← #32 ← #33.

    Conditional tracks were resolved by their prescribed go/no-go rules: #26 (S3-1) is closed not planned because no S1 heap regression reproduced; #29 (S3-3) is closed not planned because current-head cold/steady acceptance already passes.

    Final outcomes include 451.112 ms profiled / 432.327 ms control BTS create@10k, 7,944 B/row retained slope, exact 5/500 and 2/3 storm constants, split clear/destroy/worker-release costs, committed raw pre/post evidence, and preserved MTS/wire/cold/semantic gates. Each implementation issue uses Closes from its owning PR so it will close on merge.

  3. Huxpro commented on Aug 11, 2026

    @Huxpro
    OwnerAuthor

    Live-main audit (2026-08-11): HISTORICAL S3 COMPLETE. Attribution, materialization, heap, and teardown evidence were delivered by Hux PRs #25, #31, #32, and #33. The create implementation is superseded by octanejs#693/octanejs#700; the remaining live-main owners are now #43 template-run teardown, #44 cold optional worklets, and #45 backpressure/zero-command settlement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions