Skip to content

perf: use numeric indices for unkeyed de-opt children - #1030

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/deopt-implicit-index-981
Sep 10, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/deopt-implicit-index-981

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Use numeric positions for top-level unkeyed descriptor children in the client de-opt list reconciler.
  • Preserve the string namespaces for explicit keys and nested wrapper paths, with DOM and hydration regression coverage.
  • Add an isolated opt-in production browser work gate for 1,000 unkeyed children plus an explicit key="0".

Why

Changes

  • Return the numeric index for the top-level implicit case; leave explicit k… and nested JSON keys intact. No new cache or per-item work is introduced.
  • Assert survivor identity, positional remounts, user-edited input values, focus, and server-to-client adoption around mixed keyed and unkeyed children. Both new tests fail when the implicit key is deliberately made to collide with key="0".
  • Keep the new benchmark fixture in a separate Vite HTML entry and ignored build output so the standard js-framework timing bundle is unchanged.

Validation

  • pnpm sync (no generated diff)
  • pnpm format:files:check on all changed files; git diff --check
  • pnpm changeset:check
  • pnpm exec tsgo --noEmit -p packages/octane/tsconfig.json and TSRX-aware check of the changed test and fixture
  • pnpm exec vitest run --project octane --project octane-prod --silent=passed-only: 989 files, 17,592 passing tests, 14 expected failures
  • Focused de-opt keys and pure-host upgrade suites: 38/38 across development and production modes; both new tests confirmed red under a deliberately colliding key and green after restoring the candidate
  • Isolated production browser work gate: baseline constructs 1,000 implicit key strings per render, candidate constructs 0; mount/update each call scopedDeoptKey and deoptItemBody 1,001 times, update calls reconcileKeyed once, all 1,001 rows retain expected identity/order, uncontrolled input state, and focus
  • Full repository pnpm test and pnpm typecheck (the focused core suite and package/fixture checks above were run locally; repository CI will run the broader gates)

Risk / follow-ups

Refs #981.

Provenance

  • An agent produced this diff (agent-authored)

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Medium Risk
Touches hot-path reconciliation key derivation in the client runtime; semantics are heavily tested but incorrect key typing could cause list mis-reconciliation.

Overview
Top-level unkeyed de-opt list children now reconcile with numeric indices instead of allocating 'i' + index strings on every parent render. Explicit keys still use the 'k'… prefix and nested wrapper paths still use JSON; scopedDeoptKey’s return type becomes string | number.

Regression coverage adds hydration and reorder scenarios for mixed keyed/unkeyed/nested lists (DOM identity, typed inputs, focus, and keeping implicit index 0 separate from key="0").

An opt-in js-framework work gate (WORK_MODE=unkeyed) mounts 1,001 rows through a separate Vite entry, asserts production helper call counts and semantics, and can require the numeric-key implementation via WORK_REQUIRE_NUMERIC=1 without affecting the main timing bundle.

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

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.

1 participant