Skip to content

[lynx-perf-live 1] Compact template-run teardown without lazy-state materialization #43

Open

Description

@Huxpro

Classification

Performance enhancement in the Lynx template-program host path. This is a new live-main investigation, not a request to replay Huxpro #31.

Evidence

Exact same-machine expanded reverse comparison at live upstream 9b147781c9b4ec4df053a059633978ddc0ed922a:

  • Hux2 clear@10k: 727.9 ±35.3 ms
  • live main clear@10k: 976.8 ±13.9 ms (+34.2%)
  • primary CPU sample: BTS 65.1 → 134.0 ms; MTS 918.4 → 1037.1 ms

Raw runs and boundary definitions are published in the live-upstream residual audit. Huxpro #33 already separated UI clear, synchronous removeView(), and page-close-to-worker-release; it was benchmark-only.

Hypothesis

The octanejs#693/octanejs#700 dense template-run path wins creation by keeping host/public state lazy, but teardown may materialize or walk per-host records, public handles, selectors, generations, or attachment state merely to destroy one contiguous run. Hux2's older topology is slower to create but cheaper to clear.

Investigation

  1. Rebase Huxpro perf(lynx): lock teardown and storm constants #33's teardown observation boundaries onto current main; update them for mount-template-run rather than preserving old plan-wire anchors.
  2. Attribute clear@10k across background diff/staging, wire, host prepare/apply, PAPI destroy/remove, acknowledgement, page close, and worker release.
  3. Inspect whether a certified contiguous run can be retired from compact range/topology metadata without materializing otherwise-unobserved host/public state.
  4. Keep refs, callbacks, native events, attachments, lists, portals, worklets, adoption repair, rollback, stale generations, and mixed-version fallback on their existing explicit paths.

Acceptance

  • same-machine forward and reverse runs both improve clear@10k by at least 15%, or bring live main within 1.10× Hux2;
  • no deferred cleanup: post-clear/page-close heap and worker-release gates pass;
  • create, update10th, select, storms, startup/FCP, retained heap, and Web/Lynx gzip have no >5% adverse decision cell;
  • exact final DOM, keyed identity, event/ref cleanup, generation retirement, and fault rollback pass;
  • deterministic work counters fall in the stage claimed by the patch.

Non-goals

Provenance

  • An agent authored this issue (agent-authored).

Activity

  1. Huxpro commented on Aug 11, 2026

    @Huxpro
    OwnerAuthor

    Implemented and submitted upstream as octanejs#706 (ready for review).

    Final exact SHAs: base 9b147781c9b4ec4df053a059633978ddc0ed922a, candidate 8d8883c8ba01fd6061afbf3fec43df11ebd8d465.

    Acceptance conclusion: accepted.

    • clear@10k: 974.2 → 762.6 ms forward (-21.7%), 1050.7 → 720.0 ms reverse (-31.5%)
    • deterministic final counters: exactly 1 certified teardown covering 70,000 hosts per clear; the 100,000-command wire stream and synchronous cleanup boundary are unchanged
    • held heap: 42,220,672 → 42,218,772 B; post-clear residual: 25,595,760 → 25,594,348 B; every worker released
    • Web/Lynx gzip: +1.38% / +1.45%
    • n=20 follow-ups rejected apparent update/select/startup noise; no remaining >5% adverse decision cell
    • Lynx suite: 24 files / 338 tests passed; scoped typecheck, format, sync, and all 18 applicable lynx-table ratio guards passed

    The PR body contains the commands, forward/reverse samples, raw-result hashes, counter/heap/bundle evidence, correctness coverage, and fallback risk analysis.

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

    agent-authoredenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions