Skip to content

perf(octane): bring JSX keyed-list rendering closer to TSRX - #363

Merged
trueadm merged 10 commits into
octanejs:mainfrom
openai-oss-forks:fix/tsx-jsx-runtime-overhead
Jul 29, 2026
Merged

trueadm merged 10 commits into
octanejs:mainfrom
openai-oss-forks:fix/tsx-jsx-runtime-overhead

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Bring compiled TSX/JSX keyed-list updates substantially closer to TSRX without assuming an arbitrary .map is Array.prototype.map.
  • Reduce unchanged 1,000-row JSX updates from approximately 0.163 ms to 0.00122 ms (134x faster) and single-row updates from approximately 0.166 ms to 0.046 ms (3.6x faster).
  • Stack cleanly on fix(octane): scope JSX values and prevent deep SSR stack overflows #361 at 9a5c0e2d42e0afb486ebd8d8be52ae1f088abb90, including its scoped JSX, deep-SSR, lazy child-accessor, dynamic-fragment, and i18next compatibility fixes.

Implementation

  • Enable purity and automatic memoization analysis for eligible returned JSX; share TSRX's keyed-list reconciliation and per-item reuse while preserving JSX's normal public descriptor boundary.
  • Guard the optimized path to genuine dense native Arrays and the original intrinsic Array.prototype.map; evaluate the receiver and method once, then dispatch exotic/custom/overridden/subclass/species/sparse/accessor cases through the original method with its original receiver.
  • Preserve callback indices, indexed getters, constructor/Symbol.species effects, lexical this/arguments, context invalidation, server rendering, hydration identity, foreign DOM ownership, and transitions between native and custom receivers.
  • Add exhaustive development/production compiler, runtime, server, hydration, and integration regressions, deterministic JSX/TSRX compiled-work assertions, stronger production benchmark ceilings, and an Octane patch changeset.

Validation

  • Focused integrated scoped JSX, exotic maps, directive lowering, deep Fizz, foreign/portal ownership, Docusaurus, i18next, and i18next SSR: 23 files / 865 tests passed.
  • Full integrated suite across octane, octane-prod, docusaurus, i18next, and i18next-ssr: 790 files / 10,322 tests passed (./node_modules/.bin/vitest run --project octane --project octane-prod --project docusaurus --project i18next --project i18next-ssr --reporter=dot).
  • node node_modules/prettier/bin/prettier.cjs --check .
  • ./node_modules/.bin/tsgo --noEmit -p packages/octane/tsconfig.json
  • ./node_modules/.bin/tsgo --noEmit -p packages/octane/typetests/tsconfig.json
  • node scripts/check-changesets.js
  • node scripts/check-test-markers.mjs
  • node scripts/check-tsrx-module-decls.mjs
  • JSX/TSRX normalized gzip ceilings remain intact: application 2882 / 2402 = 1.19983x < 1.2x, framework 33820 / 17975 = 1.88153x < 1.9x, and total 36702 / 20377 = 1.80115x < 1.82x.
  • Fresh production Chromium comparisons pass the tightened JSX/TSRX guards: unchanged 5.17x < 6x (previous ceiling 600x), one-row change 7.57x < 10x (previously 32x), context fanout 2.19x < 2.25x (previously 3x), and mount 1.34x < 1.6x. Deterministic work checks require just three JSX descriptors and zero keyed-survivor visits on unchanged updates, and exactly one row/item body on single-row updates.
  • Direct-host SSR remains byte-identical for 1,000 rows: 29,817 raw bytes / 4,865 gzip bytes / exactly two outer markers, with server node identity retained during hydration and reordering.
  • Existing aggregate codegen-size ceiling is already red on the unchanged fix(octane): scope JSX values and prevent deep SSR stack overflows #361 base: 26,035 / 24,233 = 1.07436x > 1.04x; this branch measures 26,175 / 24,233 = 1.08014x (+140 gzip bytes in the JSX corpus, with all 15 TSRX fixtures byte-identical). No existing ceiling was weakened.

Integration

Depends on #361. Its commits currently appear in this PR while #361 is open; once #361 merges, the comparison collapses to this single focused performance commit. Preserve #361's directive-aware return lowering, lazy scoped descriptors, dynamic fragment classifier/i18next compatibility, and deep-SSR replay behavior when integrating.


Note

High Risk
Changes core compiler lowering and client/server reconciliation for JSX lists; incorrect guarding or keyed reuse would cause subtle render bugs, though behavior is heavily regression-tested.

Overview
Returned JSX keyed lists now participate in the same purity, whole-list autoMemo, and per-key survivor reuse as TSRX @for, while keeping the normal return-descriptor wrapper and JSX children semantics.

Eligible {items.map(...)} lowers through a guarded synthetic loop: receiver and map are evaluated once, then mapSlot checks for a dense native Array.prototype.map before emitting compiled keyed reconciliation; exotic receivers, sparse arrays, extra arguments, lexical this/arguments in callbacks, and overridden map stay on ordinary dispatch. Return-JSX components get component-local capture analysis so list regions can be memoized; SSR mirrors the same branch via mapSlot + ssrChild.

Runtime adds client/server mapSlot, extends childSlot for compiled map bodies (including native↔custom transitions, component rows, hydration adoption), and small scoped-children fixes for providers.

Benchmarks/docs: memo-wall README and work.mjs gain WORK_DIALECT=jsx; wall-B expectations reflect cached helper output; ratios.json tightens JSX vs TSRX ceilings (e.g. equal parent rerender 600→6). Large auto-memo.test.ts coverage for maps, hydration, and edge cases. Patch changeset for octane.

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

@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview, Comment Jul 29, 2026 10:27am
octane-website-mcp Ready Ready Preview, Comment Jul 29, 2026 10:27am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 28, 2026 22:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 28, 2026 22:20 Inactive
Comment thread packages/octane/src/runtime.ts Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 28, 2026 22:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 28, 2026 22:59 Inactive
Comment thread packages/octane/src/compiler/compile.js Resolved
@domgan-oai
domgan-oai force-pushed the fix/tsx-jsx-runtime-overhead branch from 41ca89c to bf5aaec Compare July 28, 2026 23:31
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 28, 2026 23:32 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 28, 2026 23:33 Inactive
Comment thread packages/octane/src/compiler/compile.js Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 29, 2026 00:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 29, 2026 00:01 Inactive
Comment thread packages/octane/src/runtime.server.ts Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 29, 2026 00:17 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 29, 2026 00:17 Inactive
Comment thread packages/octane/src/runtime.ts Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 29, 2026 08:44 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 29, 2026 08:44 Inactive

@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 fe085cc. Configure here.

Comment thread packages/octane/src/runtime.ts Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 29, 2026 10:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 29, 2026 10:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 29, 2026 10:26 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 29, 2026 10:27 Inactive
@trueadm
trueadm merged commit ac2ae2f into octanejs:main Jul 29, 2026
28 checks passed

This branch was previously deployed

2 inactive deployments
Preview – octane-website — bff72b4c Deployed Jul 29, 2026 by vercel[bot]
Preview – octane-website-mcp — bff72b4c Deployed Jul 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants