Skip to content

[lynx-js-framework-benchmark] A third explain instrument: element-pipeline segment attribution at the host boundary #200

Open

Description

@Huxpro

Relay issue

Work for Huxpro/lynx-js-framework-benchmark (filed here because this repo is where the session has write access). Context: the benchmark's explain axis has two instruments — the wire meter (bytes, both directions, one instrument for every framework) and per-realm CPU sampling. This proposes the third, built on the same philosophy.

The gap

Neither instrument can say where in the element pipeline time goes. Octane's lynx-table stages harness attributes first screens into segments — create / props / events / topology / flush plus off-boundary script — with a call-multiset control (callsBefore identity across samples), and that attribution is what located a 1.47× flush difference between two cells whose call multisets differ by one call (#163 C7). But that instrument is Octane-internal, exactly the flaw the benchmark's lineage table already fixed once for the wire meter.

The proposal

Instrument the host boundary — web-core's ElementPAPI surface — in the page realm before boot, the same way MessagePort.postMessage is patched for the wire meter: every framework, both the calls and their wall-time, one instrument.

  • Per-sample output: call counts and self-time per PAPI segment (create/props/events/topology/read/flush), plus the residual (framework script above the boundary). Flush is one call; its self-time is the layout/commit cost every framework pays the platform.
  • Carry the callsBefore-style identity control: a segment comparison between entries is only published when the committed-tree size control holds (same rows, same case). This makes asymmetric flush comparisons — "framework A's flush vs framework B's whole pipeline" on different trees — structurally inexpressible, a bug class Octane's own campaign hit (Device forensics: account for the ~11.6 s native apply before designing around it #157's 431 ms vs 194 ms figure).
  • Boundaries recorded per record (boundary field already exists); segment records are a new suite, not a change to existing timings — per the repo's own rule that new capture dimensions never mutate published numbers.
  • Native: out of scope for the first slice (no MessagePort-equivalent seam); state that explicitly rather than approximating.

Why it pays

It converts every cross-framework wall-clock difference into an assignable one: script vs crossings vs platform flush. The C7-class finding (append order changing flush cost at identical multisets) becomes observable for every entry, not just Octane's private cells.

Activity

  1. Huxpro commented on Aug 26, 2026

    @Huxpro
    OwnerAuthor

    Implementation evaluation found two web-core 0.22.1 facts that require an explicit semantic correction before landing this in the benchmark (tracking issue: Huxpro/lynx-js-framework-benchmark#28).

    1. ElementPAPI is not installed on the outer page global. web-core creates a same-origin sandboxed MTS iframe (createIFrameRealm) and later Object.assigns createElementAPI(...) onto that iframe window. The framework-neutral hook therefore has to be arranged by the outer page before web-core boots, but the actual wrappers must be injected into the MTS iframe before that assignment. This remains one harness instrument for every entry; it is not an entry-specific path.

    2. In this web-core version, __FlushElementTree synchronously attaches the root on first screen and performs timing-flag/exposure bookkeeping. Browser style/layout/paint occurs asynchronously after the call returns. Its JS self-time therefore cannot honestly be labelled the full platform layout/commit cost. Likewise, operation latency minus synchronous PAPI self-time is not purely framework script; it also includes scheduling and async style/layout/paint.

    I will preserve the proposed six PAPI segments and report synchronous self-time/call counts, but label the residual outside synchronous PAPI with those constituents documented. The capture will run in a separate pipeline suite/page so wrapper overhead cannot change already-published table timings. Tree/call controls stay as source detail and comparison eligibility stays derived. This is a semantic correction to the proposal, not a silent approximation.

  2. Huxpro commented on Aug 26, 2026

    @Huxpro
    OwnerAuthor

    Benchmark-side delivery is now complete in lynx-js-framework-benchmark#29.

    Final evidence:

    • 7/7 featured Web entries × 12/12 standard workload/scale cells = 84/84 measured cells
    • 7 repetitions per cell = 588/588 accepted samples, 0 DNF
    • synchronous ElementPAPI create/props/events/topology/read/flush self-time + calls
    • raw requested/committed-tree, call-multiset, and intercepted-surface controls per sample
    • outsidePapiTime remains derived-only from aligned source observations
    • clean raw receipt (dirty:false) and exact raw SHA-256 recorded in the PR
    • partial campaigns now fail closed; pipeline evidence cannot replace the existing table/startup comparison cohort
    • old-data invariance verified: all 975 non-pipeline comparison records and Native coverage are byte-identical with/without the new campaign
    • site now shows absolute operation/PAPI/outside values, PAPI share, normalized six-segment zoom, calls, and control evidence across all 12 cells and 7 frameworks

    The UI and PR retain the corrected boundary semantics from the earlier note: flush is synchronous web-core host work, not full layout/paint, and the residual includes scheduling/asynchronous browser work. Native remains outside this first slice because there is no framework-neutral ElementPAPI seam.

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