Skip to content

[lynx-perf-live 7] Reduce PAPI and host-apply cost per materialized row #49

Open

Description

@Huxpro

Context

The owner-first measurements from #47 reject the packet/ACK hypothesis and identify host materialization as the actual create-path owner.

At 1k / 10k / 30k rows:

  • PAPI creation is 41.8% / 48.1% / 51.2% of create latency.
  • Remaining host apply is 27.6% / 28.4% / 28.4%.
  • Together they own 69.5–79.6% of create and scale approximately linearly.
  • Clone/transfer is only 0.2–0.9%; ACK/publication is effectively zero for create.
  • The current stack already uses the public dense intrinsic factories and append API introduced before this experiment.

Evidence and the reproducible harness are in octanejs#717.

Scope

  1. Attribute PAPI intrinsic construction, property application, insertion/flush, and other host work inside the measured materialization stages.
  2. Reconfirm an owner of at least 10% before changing production code.
  3. Optimize the owning host/PAPI boundary without changing benchmark semantics or suppressing validation.
  4. Preserve template-run, instance, value, public-handle, identity, event, and teardown semantics.

Acceptance

  • create 10k, replace-all 1k, and append 1k improve by at least 15% in both AB and BA orderings
  • no unrelated tracked v2 cell regresses by more than 5% in both orders
  • deterministic command/instance/value invariants remain correct
  • exact Web and Lynx bundle deltas remain within the approved budget
  • any wire claim is measured per endpoint/direction; total-wire reduction is not assumed to be the lever

Non-goals

  • do not pursue packet encoding or ACK deletion without a new owner-first measurement
  • do not count WebCore event/control traffic as Octane commit payload
  • do not weaken the benchmark or validation boundary

Provenance

  • An agent authored this issue

Activity

  1. Huxpro commented on Aug 12, 2026

    @Huxpro
    OwnerAuthor

    Owner re-confirmation (speed-of-light probe): the per-element MTS machinery gate FAILS — and the real create-gap owner is elsewhere

    Per this issue's scope step 2 ("reconfirm an owner of at least 10% before changing production code"), a bare-PAPI speed-of-light probe now bounds the platform floor for the exact 10k-row shape (70k host elements) in the same main-thread realm as the receiver, interleaved AB/BA with octane control/profile create cells (n=5, zero DNF, quiet host):

    stage octane (stage clock) bare-PAPI floor collapsible share of create wall
    papi_element_creation 561.5 ms 556.0 ms 5.5 ms 0.5%
    mt_apply_other 344.3 ms 291.7 ms (props+events+tree) 52.6 ms 4.6%
    flush batching (single vs ⌈n/10⌉ chunks) — 2183.8 vs 2190.1 ms ~0 0%

    Verdict: NO-GO for all three planned sub-owners (create-with-props call fusion, flattened per-host bookkeeping, batched insertion) — the stages this issue targets are 85–99% irreducible host cost on the web harness, and the acceptance bar (≥15% improvement on create/replace/append) is unreachable from them.

    Where the featured-harness create gap actually lives. The probe window also exposed that octane create@10k costs ~1,145 ms on a fresh page but ~1,980–2,040 ms under the public runner's warmed-page protocol (2×1k create/clear warmup, clear before each rep — the standard krausest shape). Wire deltas isolate the cause:

    • fresh create@10k: MTS→BTS 1,016 B / 5 messages
    • warmed create@10k (any create after a clear): MTS→BTS 17.2–17.4 MB / 2 dispatchCoreContextOnBackground messages (~1.7 KB/host), plus BTS self-time growing per cycle (304→877 ms over 4 cycles) and MTS self +~600 ms

    Mechanism (code-confirmed): prepareLynxHostBatch's compactCandidate requires initiallyEmpty && initiallyNoGenerations, and acceptedLazyPublicInstances requires !initiallyEmpty. After a full clear, records are empty but the generation table is not — so a create-after-clear qualifies for neither compact ACKs nor lazy public instances and falls back to full per-host handle deltas with snapshots. First creates publish ~nothing; every later create republishes the world.

    That re-publication cliff — not per-element PAPI cost — is the ≥10% owner for the featured create cell (it is worth ~600–900 ms of the ~975 ms octane-vs-React gap), and it also feeds the BTS CPU, reverse-wire, and MTS-heap items on the roadmap. Fix work proceeds under #51 item 2 (re-scoped accordingly); this issue's own optimization scope is closed as measured-NO-GO unless a native-harness measurement reopens it.

    Evidence: probe + results on fork branch perf/lynx-papi-floor (head 30a2ae34, based on upstream main 6079a680); attribution runner on fork branch perf/lynx-bts-render-diet. Upstream draft-PR publication is currently blocked: the GitHub App has no write access on octanejs/octane (cross-fork PR creation returns 403), so the stack lives on the fork until an octanejs admin grants the app access — after that each branch becomes a draft PR unchanged.


    • An agent authored this comment (agent-authored)

    Generated by Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions