Skip to content

perf: bound the Element PAPI floor for per-row main-thread materialization - #748

Merged
trueadm merged 2 commits into
octanejs:mainfrom
Huxpro:perf/lynx-papi-floor
Aug 13, 2026
Merged

trueadm merged 2 commits into
octanejs:mainfrom
Huxpro:perf/lynx-papi-floor

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add benchmarks/lynx-table/stages/papi-floor.mjs: a speed-of-light Element
    PAPI probe that bounds the platform floor for materializing the exact
    10,000-row table shape (70k host elements) with a bare public-PAPI loop in
    the same main-thread realm where Octane's receiver runs
  • reset both main-frame and background-worker profiler records after initial
    settle so create attribution excludes first-screen work
  • record the corrected floor and same-window Octane stage decomposition in
    stages/results/papi-floor-10000.{json,md}
  • no product code changes

Why

#49 (roadmap item 1 of the Huxpro#51 umbrella) requires re-confirming a
≥10% owner inside the measured papi_element_creation / mt_apply_other
stages before touching production code. The probe answers the prior question:
how much of those stages is irreducible host cost, and how much is collapsible
Octane-side machinery?

Measured verdict (n=5, quiet host, zero DNF; full data in stages/results/papi-floor-10000.md)

  • papi_element_creation is 96.4% platform floor (bare-loop 139.2 ms vs
    stage 144.4 ms): collapsible 5.2 ms = 1.7% of the create wall. The factory
    calls themselves are host cost; only fewer calls would change it, and the
    row shape (7 host nodes incl. raw-text children) is fixed by the driver
    contract and native parity.
  • mt_apply_other is 82.1% floor-equivalent (props+events+tree 79.0 ms
    vs stage 96.2 ms): collapsible 17.2 ms = 5.5% of the create wall.
  • Flush batching is not a lever: single-flush 586.3 ms vs chunked
    (⌈rows/10⌉) 583.6 ms. Same-window octane create walls: control 313.9 ms,
    profile 325.0 ms.
  • All three sub-owner candidates named by the roadmap for per-element MTS
    machinery (create-with-props call fusion, flattened per-host bookkeeping,
    batched insertion) fail the ≥10% owner gate on the web harness: NO-GO
    for that product change; the probe ships as the reusable measurement
    instrument and negative control. The featured create-cell ownership moved to
    cross-cycle state accumulation, which the next stacked PR measures and
    fixes.

Validation

  • pnpm sync
  • pnpm format:files:check on all six changed files
  • node --test benchmarks/lynx-table/stages/*.test.mjs (9 passed)
  • corrected probe run: n=5 per cell, interleaved AB/BA, quiet-host
    preflight enforced, zero DNF
  • pnpm typecheck — not run: no TypeScript surface changed
  • pnpm test — not run: benchmark-only change; targeted stage tests pass

Risk / follow-ups

  • Benchmark-only change; no runtime surface touched. Results are host-stamped;
    the floor claim is scoped to Lynx-for-Web. The one-shot foreign-task
    presentation anomaly (373.7 ms vs Octane's 36.4 ms message-paced residual)
    is documented as renderer scheduling and excluded from the stage-floor
    comparison.
  • A focused regression test now verifies that accumulated counters are cleared
    in both frame and worker realms before an operation.
  • Follow-up (next stacked PR): the create-after-clear re-publication cliff per
    the measured ownership.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


Generated by Claude Code


Note

Low Risk
Benchmark-only changes under benchmarks/lynx-table/stages; no runtime or product code touched.

Overview
Adds stages/papi-floor.mjs, a Playwright benchmark that materializes the 10k-row table shape via bare public Element PAPI loops (with optional chunked flush) in the same main-thread realm as Octane, then compares phased timings to interleaved Octane control/profile create runs and emits JSON/Markdown with ≥10% owner-gate verdicts for papi_element_creation and mt_apply_other.

Refactor: realmSnapshots / resetProfiles move from run.mjs into shared profile-realms.mjs (with a small unit test); run.mjs imports the module unchanged in behavior.

Artifacts: checked-in stages/results/papi-floor-10000.{json,md} from a quiet-host n=5 run (host-specific numbers; documents NO-GO on per-element MTS micro-optimizations at this shape).

Reviewed by Cursor Bugbot for commit 6082ac5. Bugbot is set up for automated code reviews on this repo. Configure here.

…ation

Add a speed-of-light probe that materializes the exact 10,000-row table
shape with a bare public Element PAPI loop in the same main-thread realm
as the Lynx receiver, interleaved AB/BA with octane control/profile
create cells, and record the measured floor:

- papi_element_creation is 99.0% platform floor (collapsible 0.5% of
  the create wall)
- mt_apply_other is 84.7% floor-equivalent (collapsible 4.6%)
- chunked vs single flush makes no difference

All three sub-owner candidates from the roadmap fail the >=10% owner
gate for per-element MTS machinery on the web harness.

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 30a2ae3. Configure here.

@trueadm
trueadm marked this pull request as ready for review August 13, 2026 14:33
@trueadm
trueadm merged commit 8a62ed6 into octanejs:main Aug 13, 2026
12 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants