Skip to content

bench(lynx): gate the dual-thread commit wire cost against a changed-rows floor - #660

Merged
trueadm merged 3 commits into
octanejs:mainfrom
Huxpro:lynx/bench-wire-instrumentation
Aug 10, 2026
Merged

trueadm merged 3 commits into
octanejs:mainfrom
Huxpro:lynx/bench-wire-instrumentation

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Octane's Lynx renderer currently loses point-update benchmarks to ReactLynx and Vue Lynx by roughly an order of magnitude at scale, and the dominant cause is measurable, deterministic, and — until now — untracked: the commit wire payload is proportional to tree size, not change size. Selecting one row in the 10,000-row cross-framework table serializes ~30,000 commands / 2,406,468 bytes (every row's freshly re-encoded class array plus two bindtap re-binds), identical in size to a commit where every tenth row actually changed. This PR lands the instrument that turns that gap into CI-tracked numbers before any fix does:

  • @octanejs/lynx wire profiler (__OCTANE_LYNX_PROFILE__ → globalThis.__OCTANE_LYNX_PROF): per-thread commits, commands, serialized bytes, and pipeline-stage milliseconds (self-check / dispatch / validate / prepare / apply / ack). Compiled away when the define is absent; the hot paths pay nothing.
  • benchmarks/lynx-table — the krausest-style table app mirrored operation-for-operation from the Vue Lynx unified benchmark matrix, driven through the real background root, async transport, main-thread receiver, and host driver via real tap tokens, reporting deterministic per-operation command counts and commit bytes against a changed-rows floor (the commands a change of that size strictly implies).
  • benchmarks/lynx-table/web — the Lynx-for-Web wall-clock harness: the same app for octane and vendored ReactLynx / Vue Lynx vdom / Vue Lynx vapor reference bundles (reference/manifest.json records provenance) under one byte-identical Chromium page driver. Host-bound medians, no ratio guards; the recorded baseline feeds a site chart in a follow-up PR.
  • 12 ratios.json guards pinned at today's measured waterline, each marked KNOWN GAP with the instruction that fixes must TIGHTEN them:
op @10k measured changed-rows floor ratio
select 30,000 cmds / 2,406,468 B 2 cmds / ≤2,048 B 15,000× / 1,175×
update every 10th 31,000 cmds 1,000 31×
update storm ×50 1,550,000 cmds 50,000 31×
select storm ×30 900,000 cmds 60 15,000×

Wall clock on the same host, same instrument (medians, 10k rows): select 1374ms vs vue-vdom 149 / vue-vapor 160 / react 176; update10th 1493 vs 193/152/273.

Why identity-diffing can never pass on a transported root: every object-valued prop is re-encoded through the wire clone per render, so Object.is fails for every object-carrying host on every commit. A fix PR that makes the prop diff value-semantic (and stops re-announcing unchanged listeners) follows on top of this branch and tightens every guard above to ~1.0×.

Measurement honesty rules are documented in benchmarks/lynx-table/README.md: no octane-only bespoke workloads, every number from the same instrument that measures the references, and a cell that cannot be driven end-to-end reports "not measured", never a number from a degraded run.

Validation

  • pnpm format:check
  • pnpm typecheck (ran tsc -p packages/lynx clean; full workspace typecheck not run in this environment)
  • pnpm test (targeted below; browser-dependent projects unavailable in the measurement container)
  • targeted tests: packages/octane-mcp-server (suite manifest), packages/lynx/tests/runtime-compatibility.test.ts (source graphs incl. the new profiling.ts)
  • node benchmarks/bench.mjs --quick --ratios --only lynx-table → PASS (guards pin the current waterline; any regression breaches)
  • node benchmarks/bench.mjs --record --only lynx-table / --only lynx-table-web → checked-in baselines

Risk / follow-ups

  • The profiler's byte counter is JSON.stringify length — a structured-clone-cost proxy, documented as such.
  • The wall-clock suite needs headless Chromium; it carries no ratio guards, so environments without a browser lose only the informational numbers.
  • Fix PR (value-semantic slot equality) and site-chart PR follow on this branch.

Provenance

  • An agent produced this diff (agent-authored)

Note

Low Risk
Test-only timeout and comment; no runtime behavior changes.

Overview
Raises the Vitest timeout on the Solana React hydration case from the default 5s to 30s, with a short comment that the shared renderHydrationFixture path starts a real Vite SSR server and can overrun the default on a busy CI shard.

No production or hydration logic changes—only test stability.

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

…rows floor

A point update's commit currently ships the whole tree: selecting one row in
the 10,000-row cross-framework table serializes ~30,000 commands / 2.4MB —
identical in size to a commit where every tenth row actually changed —
because every row's re-encoded class array and both bindtap closures cross
the wire on every commit. This adds the instrument that makes that cost a
tracked, gateable number before any fix lands:

- @octanejs/lynx gains a permanent __OCTANE_LYNX_PROFILE__-gated wire
  profiler (globalThis.__OCTANE_LYNX_PROF): per-thread commits, commands,
  serialized bytes, and pipeline-stage milliseconds. Compiled away when the
  define is absent.
- benchmarks/lynx-table drives the krausest-style table app (mirrored
  operation-for-operation from the Vue Lynx unified benchmark matrix)
  through the real background root, transport, main-thread receiver, and
  host driver via real tap tokens, and reports deterministic per-operation
  command counts and commit bytes against the changed-rows semantic floor.
- benchmarks/lynx-table/web is the Lynx-for-Web wall-clock harness: the
  same app for Octane and vendored ReactLynx / Vue Lynx vdom / Vue Lynx
  vapor reference bundles under one byte-identical Chromium page driver.
- ratios.json gains 12 lynx-table guards pinned at today's measured
  waterline (select = 1500x the floor, update10th = 31x, storms likewise),
  each marked KNOWN GAP with the instruction that fixes must tighten them.
  CI now fails on any further regression and visibly tracks the gap itself.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SW6xKsEpmsN7rFu4K9mFM9
@Huxpro

Huxpro commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Follow-ups on this instrument: #661 (site charts), #662 (the fix)

@domgan-oai
domgan-oai marked this pull request as ready for review August 9, 2026 10:33
@vercel

vercel Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
octane-website Skipped Skipped Aug 10, 2026 9:54am
octane-website-mcp Skipped Skipped Aug 10, 2026 9:54am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 10, 2026 09:54 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 10, 2026 09:54 Inactive
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants