Skip to content

Retrospective: new-lynx first principles, the theoretical ceiling, current state, and what a redesign should re-open #281

Open

Description

@Huxpro

A full-campaign retrospective, written as the seed document for a design-rethink session. Scope: the #58 founding roadmap → new-lynx@ac9bb9286 (gate Trains 1–7 all merged, CI green on first attempt throughout). Facts are grounded in PRs/issues/evidence records and labeled verified / hypothesis; #103 holds the per-train gate records.


1. The first principles behind new-lynx

P1 — A compiled program beats an interpreted plan (the block-core conviction). Templates split static/dynamic at compile time: static structure is encoded once, create is a straight-line PAPI-emission function, dynamic slots are compile-time-stable. The hot path admits no generic host-command vocabulary, no plan interpreter, no per-prop capability dispatch (#58's verdict table: PAPI/host materialization owned 69.5–79.6% of create while the wire owned 0.2–0.9% — the representation was the owner, not the wire). The principle's terminal form is E1: the compiled main-thread program becomes resident at a (module, index) address and mount-program-run puts a name on the wire instead of a description (#246/#269).

P2 — Wire and acknowledgements must be O(change)/O(runs), never O(tree)/O(hosts). Template-run collapse, compact-ACK (and its re-arm, #233), destroy-run, retired-range tombstones. The wire floors are constructive lower bounds enforced by ratio gates, not optimization targets.

P3 — The main thread paints before it describes. The synchronous first screen goes through direct PAPI emission (the L3 direct applier); the description is lazy until first read (#153); capture+announce moved out of the paint window (#273); the background adopts the painted tree rather than repainting it. "The boundary moves in time, not in order."

P4 — Never buy milliseconds by weakening an invariant. Declines never approximate (every refusal carries a diagnostic and never an approximation); strict protocol validation is retained and tiered (checked|trusted, #164/#165), not deleted; #279 answered a producer/resident arity mismatch by making range-bearing programs unaddressable — falling back to the descriptor — rather than by widening validation. After the differential-blindness incident (#272: a ?null → ?'' mutation survived 800 tests because both arms moved together), shared code must carry direct invariant assertions, and any dual-arm feature must be one body, two entries.

P5 — Measurement discipline is a design input, not a reporting format. Owner-first (a ≥10% measured owner before any knife), speed-of-light floors (#53's papi-floor: on web, papi_element_creation is 99% platform floor), interleaved A/B with alternating order, every quoted millisecond names its method, evidence JSON lives in the repo, web milliseconds are indicative-only (the target engine has no JIT), and — hardened into a gate by #274 — verify the mechanism is engaged before quoting any number.

2. Where the theoretical ceiling sits relative to ReactLynx / Vue

On-paper derivation (verified via #52's host-call census): Octane issues 20 host calls per row vs ReactLynx's 21 and Vue VDOM's 25 — fewest of the three, perfectly linear 1k→30k. The shared Web Core floor is genuinely shared (composed startup+create within 0.1% of ReactLynx). Therefore:

  • Create ceiling = platform floor + a constant framework overhead, positioned at or below ReactLynx (which still pays snapshot/patch interpretation per row) and approaching Vue Vapor (whose compile-time split is the same idea; our irreducible extra is the dual-realm protocol itself). The web lane has cashed this in: create@10k at 0.935× React, with perf: bound the Element PAPI floor for per-row main-thread materialization #53 bounding the remaining compressible space under ~5% — we are at the web ceiling.
  • FCP ceiling ≈ ReactLynx (shared loadBundle pipeline, with all the capture/publish cuts landed). The first device observation supports it: FCP@1k 1416.6 ms vs ReactLynx's 1389.2 ms (1.02×, a one-shot acceptance observation, feat(lynx): publish loadBundle first-screen timing #280).
  • The correction — and the core input for the rethink: the device runs a different cost universe. Benchmark PR bench: refresh Octane Hux compiled-create + FCP data lynx-js-framework-benchmark#50: create@1k 15,941 ms (138× the web number, rank 6/6), superlinear 1k→3k (3× rows → 8.6× time), while select/update sit at an ordinary 4–7× interpreter tax and rank mid-pack. On device the ceiling is not set by PAPI but by (no-JIT BTS render + cross-VM bridge/materialization + no-JIT MTS apply) — and the ownership among those three segments is unadjudicated (bench(lynx): native attribution benchmark — split BTS / bridge / MTS ownership of the LepusNG create collapse #278's four-segment attribution benchmark was designed for exactly this and has not yet run). Until that verdict lands, which side of ReactLynx the device ceiling sits on is an open question, not a known quantity.

3. What is implemented, and what deserves a first-principles re-examination

Landed (all on new-lynx, seven gate trains, first-attempt-green CI): L0 IR spec → L1 target:'lynx' compiler backend → delta protocol v2 (#61) → L3 direct first-screen applier → the transport codec (#152 → #164/#165: a LynxValueRef never escapes the transport) → the C/D train series → wire cliff + compact-ACK re-arm (#233) → E1 in full (#269: mount-program-run + build-time digest cross-check) → the FCP publish stack (#270 lazy handles / #271 props adoption, −28.9% interleaved / #272 create-without-diff, 40k allocations removed) → capture-after-paint (#273 + two capture-gap fence fixes) → device enablement (#279 tap/arity, #280 loadBundle FCP pipeline). Six-axis scorecard: wire O(1) ✓, first-screen mount ✓, steady-state ✓, clear 1.02× ✓, retention resolved, web create 0.935×.

Worth taking back to first principles (ordered by suspicion weight):

  1. The materializing transport itself. Root cause: the Lynx ContextProxy is a string-only channel; Octane sends live JS values #152's answer — the codec fully materializes every inbound composite so bridge values never escape — is correctness-first, but it turns every O(rows) payload into a per-node interpreted walk plus allocation inside a no-JIT VM. This matches PR [lynx-perf-live 8] Instrument the ReactLynx reference with the same stage decomposition to attribute the FCP residual #50's collapse shape exactly (bulk-only, device-only, superlinear) — hypothesis, bench(lynx): native attribution benchmark — split BTS / bridge / MTS ownership of the LepusNG create collapse #278 adjudicates. Alternative representations: a single JSON string across the bridge parsed by the engine's C JSON.parse; a typed-array/binary wire; or making more state resident so less crosses at all (see 3). This is the candidate device-side reversal of the original "the wire is not the problem" verdict — a verdict that only ever held in a both-sides-JIT world.
  2. E1's range representation. fix(lynx): decline addressed runs for runtime ranges #279 exposed that the background producer and the resident wire are two derivations of one truth whose arity can diverge; the current fix (range-bearing programs are unaddressable) sends the benchmark row shape back to the full-descriptor path. Two ways forward, to be chosen by bench(lynx): native attribution benchmark — split BTS / bridge / MTS ownership of the LepusNG create collapse #278 data: the compiler proves the text holes scalar, or the resident form grows range awareness. One level deeper: the address digest cross-check should cover arity.
  3. BTS render cost under no JIT. The entire background reconciler was optimized on V8. If bench(lynx): native attribution benchmark — split BTS / bridge / MTS ownership of the LepusNG create collapse #278 blames BTS, the Vapor-style "compile the interpretation away" extends to the background side too (emit create functions for BTS, not just MTS). The 43 s startup adoption@1k in PR [lynx-perf-live 8] Instrument the ReactLynx reference with the same stage decomposition to attribute the FCP residual #50 is this suspicion's strongest evidence.
  4. Validation tier selection on device. The checked|trusted mechanism exists; whether a same-app dual-realm production wire should run trusted is a legitimate dial — distinct from the forbidden move of relocating validation out of the publish window ("relocation is not a cut").
  5. The capture rung (perf(lynx): #273's default setTimeout rung fires before the first frame on LepusNG #277). LepusNG's setTimeout fires ~1.85 ms before the first frame, so perf(lynx): describe the first tree after the frame it describes #273's win is not yet collected; scheduleFirstScreenCapture needs a frame-anchored callback. A design-recon comment is on the issue.
  6. Bundle size and cutover. Roadmap: replace the universal-renderer target for Lynx with a Lynx-specialized compiler and renderer #58's targets — ≤1.5× the ~51 KB competitor median (from a 159 KB start), and the L5 flip of lynxRendererRules to the new target — were not advanced during this campaign. The rethink should decide where they sit in the new priority order.

4. Key difficulties and the decisions made

Difficulty Decision Consequence / lesson
Semantic-drift risk of a third hook/reconciler core (L0 Q1) Kernel-extraction spike, then the delta protocol rewritten as v2 per #61, keeping the universal behavioral surface as the oracle The 15K-line universal test surface became the porting guardrail
LEPUS_TAG_LEPUS_REF bridge values crash Reflect.ownKeys (#152) The transport exclusively owns materialization; refs never escape Killed the crash; may have concentrated the cost (re-exam item 1)
Wire cliff: create-after-clear reshipped a 17 MB acknowledgement (#231/#233) Compact-ACK re-arm + presence rung + the correlated-ready fence That fence was later reused, not rebuilt, by #273
A V8 ablation sentenced E1 to death (<4%) → archived Owner challenge: the ablation covered 1 of 4 cost segments and was V8-only; archive rescinded → implement-first mode (fewer stoppers, implement fully, the device round owns the regression verdict) E1 landed in full; "implement first, adjudicate later" became the E-phase operating mode
Differential blindness: both arms drift together, 800 tests stay green (#272) Permanent acceptance criteria: direct assertions + one body, two entries #273 was proactively built to that shape
Tree-scan fusion measured as relocation, not reduction, after being built The knife was dropped ("relocation is not a cut") Three publish remainders explicitly deferred instead of forced
The Blacksmith runner pool died Reversible swap to ubuntu-latest (#260), incidentally fixing three outage-masked defects First-attempt-green CI became the per-train norm
The device baseline produced zero milliseconds (#274) No numbers were forced: three preconditions each got an issue (#275/#276/#277), all fixed under P4 (#279/#280) "Verify engagement before quoting milliseconds" entered the methodology
The tap blocker's root cause was protocol rejection (arity 3 vs 1), not the event path Refuse range addressing rather than widen validation (#279) E1 is "not yet entered" for the benchmark shape, pending #278's route choice
Web and device cost models diverged (PR #50's collapse) Designed the four-segment attribution benchmark (#278: floors + runtime-swap + encoding controls) The single most important pending input for the rethink

One-line summary for the rethink session: principles P1–P5 were fully cashed in and verified on the web lane (create at the floor, FCP in React's bracket); what the device exposed is not that the principles are wrong, but that their cost model was calibrated in a JIT universe. The one big question the next design round must answer: in a dual-no-JIT, cross-VM-bridge universe, who is the owner (#278) — and how far down should P1's "compile the interpretation away" extend (the BTS render? the transport representation? both)? Until #278's verdict lands, no layer should be cut.

Reference index: founding #58; protocol #61; E1 #246/#269/#279; FCP #247/#270–#273/#277/#280; transport #152/#164/#165/#233; device baseline #274 (report at docs/reports/lynx-b230-lepusng/) /#275/#276; attribution design #278; per-train gate records #103; cross-repo: lynx-js-framework-benchmark PR #50 (the native collapse data).

Activity

  1. changed the title [-]Retrospective: new-lynx 第一性原理、理论天花板、实现现状与重审清单(rethink session 底稿)[/-] [+]Retrospective: new-lynx first principles, the theoretical ceiling, current state, and what a redesign should re-open[/+] on Sep 6, 2026
  2. Huxpro commented on Sep 6, 2026

    @Huxpro
    OwnerAuthor

    已按本次请求发布下一轮总路线 #282,包含 5 个 GitHub milestones、9 个新执行 issues(#283–#291),并复用 #278/#255/#277/#241/#193/#201/#197。

    顺序是:可信 baseline/归因 → bulk create → adoption/交互 → 平台下限与默认路径 → 完整发布验收。超越 latest upstream 是独立硬门槛;ReactLynx/Vue 也使用最新可运行配置,不以旧参考包代替当前对手。

    这次 agent 源码核对有两项会改变原报告的计划前提:

    已核对 #103 Train 7、#227 同步实验、#196 成本模型和 #193 最新设计。此次只发布计划,未产生新的性能实验或收益声明;#282/#291 写明完成标准与尚待证明的部分。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions