Skip to content

[lynx-perf-live 5] Measure template ingress ownership and split host materialization #47

Open

Description

@Huxpro

Classification

Performance enhancement in the live-main Lynx template-run materialization, wire, host expansion, and acknowledgement path.

Evidence

Exact same-machine featured run at upstream 9b147781c9b4ec4df053a059633978ddc0ed922a:

operation Octane latency React/Vue range Octane total wire React/Vue total-wire range
create@10k 2161.6 ±115.9 ms 1060.2–1417.8 ms 17.77 MB 1.85–3.84 MB
replace@1k 265.4 ±74.1 ms 126.6–157.0 ms 2.44 MB 0.20–0.40 MB
append1k@1k 179.1 ±17.2 ms 110.8–141.2 ms 1.78 MB 0.19–0.39 MB

Create@10k also records 932 ms BTS CPU versus a React/Vue median near 240 ms. Evidence: raw featured run and benchmark PR.

The existing deterministic gate proves create already emits one shared-template run and exactly the required 10,000 Row body executions. Therefore this issue is not permission to replay the superseded Hux2 materialization stack or weaken the changed-rows model.

Hypothesis

The remaining gap is inside one or more of:

  • compiler-emitted template values and per-instance wire representation;
  • background value packing, validation, or structured-clone preparation;
  • main-thread program expansion and host preparation;
  • PAPI element/property/insertion work;
  • acknowledgement, public-handle, selector, generation, or attachment publication.

The owner must be observed before changing representation. A shorter packet that materializes more retained state or moves work beyond the DOM predicate is not a win.

Investigation

  1. Reuse the stage-decomposition harness for create, and extend it to replace/append with fresh-realm AB/BA controls.
  2. Record bytes and messages by direction and endpoint, commands, values/row, template programs/runs, public-handle deltas, clone time, expand time, host-prepare/apply time, PAPI time, acknowledgement time, and final presentation.
  3. Compare rows 1k/10k/30k to separate constant, per-run, per-row, and superlinear costs.
  4. Require a directly observed owner to contribute at least 10% of the operation before authorizing a product experiment.
  5. Split product experiments into rollback commits: value encoding, clone-safe representation, main expansion, and acknowledgement/public-state changes must remain independently measurable.
  6. Preserve late chunks, first-screen adoption/repair, mixed-version fallback, refs, events, lists, portals, worklets, attachments, rejection, and disposal.

Acceptance

  • forward and reverse same-machine runs improve create@10k, replace@1k, and append1k@1k by at least 15% each;
  • total wire for each decision cell falls at least 50%, with an itemized explanation of both directions;
  • create remains one shared-template run and Row body renders stay at the semantic floor;
  • bytes/row and direct CPU stages scale linearly from 1k through 30k, with no hidden post-predicate or deferred-ACK work;
  • BTS/MTS retained heap, post-clear release, startup/FCP, update/select, swap/remove/clear, storms, and Web/Lynx gzip have no >5% adverse decision cell;
  • exact rows, labels, keyed identities, events/refs, generation retirement, mixed-version fallback, rejection, and rollback pass;
  • final evidence records source SHA, bundle hashes, host/browser versions, sample order, n, medians, spread, and zero DNF/null cells.

Non-goals

Provenance

  • An agent authored this issue (agent-authored).

Activity

  1. Huxpro commented on Aug 11, 2026

    @Huxpro
    OwnerAuthor

    Review update after #43–#45

    Decision: keep this issue open, but tighten how its hypothesis is applied. The historical large packet is still unexplained; it is no longer sufficient to assume that packet or ACK count is the latency owner.

    • #43 / upstream #706 improves clear by 21.7% forward and 31.5% reverse while leaving the 100,000-command wire stream unchanged. This proves that host preparation/materialization can be the owner even when bytes do not move.
    • #45 cuts storm messages by 33% without a bidirectional wall-clock win, while zero-settlement/pacing badly harms selectStorm. ACK count, zero-byte settlement, and message merging are therefore negative controls, not starting designs.
    • #44 / upstream #707 changes the optional main-thread module graph, not the per-row path. It still changes the build baseline, so final source and bundle hashes must come from the integrated stack.

    Execution plan

    1. Re-record create@10k, replace@1k, and append1k@1k after perf(lynx): specialize compact run teardown octanejs/octane#706/perf(lynx): keep optional worklet runtime cold octanejs/octane#707 integration, together with every ReactLynx/Vue reference entry on the same machine and lockfile.
    2. Land measurement-only decomposition before product code: per-direction bytes/messages, values per row, clone/transfer duration, BTS packing/validation, MTS expansion/prepare/apply, PAPI work, ACK/public-state duration, presentation, heap, and post-clear release. Scale at 1k/10k/30k.
    3. Authorize one rollback-sized experiment only when its directly observed stage contributes at least 10% of the decision cell. Keep value encoding, clone representation, MTS expansion/host preparation, PAPI, and public-state/ACK changes separate.
    4. Read the current acceptance as a dual gate: a wire/encoding candidate must reduce total wire by at least 50% and improve all three wall-clock cells by at least 15% in both orders. If wire is not the owner, split or retitle the issue around the measured CPU stage rather than manufacturing a packet win. ACK/message savings alone never satisfy acceptance.
    5. Re-run exact semantics plus swap/remove/clear, storms, startup/FCP, retained heap, worker release, and Web/Lynx gzip. No pacing or local-settlement variant should be revived without new evidence that falsifies [lynx-perf-live 3] Backpressure-driven pacing with zero-command settlement #45.

    The issue does not need a target change yet; it needs a post-stack baseline and an owner-first implementation decision.

  2. changed the title [-][lynx-perf-live 5] Reduce template-run materialization and acknowledgement bytes per row[/-] [+][lynx-perf-live 5] Measure template ingress ownership and split host materialization[/+] on Aug 12, 2026
  3. Huxpro commented on Aug 12, 2026

    @Huxpro
    OwnerAuthor

    Completed the owner-first experiment and applied the latest execution constraint literally.

    Measurement-only upstream draft PR: octanejs#717
    Published head: b84b102c6726571766a3ea29901d68d2e2e55b9e
    Split owner issue: #49

    Decision

    NO-GO for packet/encoding and ACK product changes. SPLIT for the measured owner.

    The harness now measures fresh-page AB/BA create/replace/append at 1k, 10k, and 30k and separates BTS replay, clone/transfer, MTS validation/expansion/preparation, PAPI creation, remaining host apply, ACK/publication, and presentation residual.

    create scale wall replay clone PAPI host apply ACK residual
    1k 148.3 ms 18.1% 0.4% 41.8% 27.6% 0.3% 8.9%
    10k 1201.5 ms 12.2% 0.3% 48.1% 28.4% 0.0% 9.9%
    30k 3498.6 ms 9.8% 0.3% 51.2% 28.4% 0.0% 8.6%

    Clone/transfer is only 0.2–0.9%, below the 10% owner gate. ACK/publication is 0–0.3% for create and about 11–16% for replace/append, so even complete deletion cannot satisfy all three ≥15% latency cells and the 50% total-wire gate.

    At 10k, endpoint-level counters also show replace/append total wire is dominated by WebCore event/control traffic, not Octane commit payload. The real owner is PAPI creation plus remaining host apply, which accounts for 69.5–79.6% of create and scales linearly. That work is now isolated in #49 with its own owner-first acceptance gates.

    Checked-in evidence:

    • stages/results/live-1000.{json,md}
    • stages/results/live-10000.{json,md}
    • stages/results/live-30000.{json,md}
    • stages/results/live-report.md

    Stage unit tests, latest-main control/profile/vue-vdom smoke, formatting, and pnpm sync pass. The issue title was updated to reflect the measured outcome and split; it remains open pending review/merge of the measurement PR.

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