Skip to content

perf: seed raw HTML and deopt DOM expandos - #1015

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/seed-dom-expandos-981
Sep 9, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/seed-dom-expandos-981

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

  • Seed the raw HTML ownership keys and de-opt descriptor symbol on native DOM prototypes, plus the uncontrolled defaultValue baseline symbol.
  • Define the new keys as nonenumerable so DOM for...in walks do not expose them.
  • Add behavioral regressions for checkbox reset baselines and mixed raw HTML/de-opt hosts, and a production Node/jsdom miss probe.

Why

#981 identified repeated absent-property reads on ordinary DOM nodes after raw HTML ownership is activated and during de-opt child scans. Bootstrap now turns those misses into inherited undefined reads. The defaultChecked initialized symbol is deliberately not seeded: its only runtime read is a presence test, and seeding it would force an own-property check on every first defaultChecked write.

Validation

  • pnpm format:check (repository-wide check not run)
  • pnpm typecheck (repository-wide check not run)
  • pnpm test (repository-wide prechecks and browser projects not run locally)
  • pnpm sync (no generated changes)
  • pnpm exec tsgo --noEmit -p packages/octane/tsconfig.json
  • 228 focused tests across 16 development/production project runs, covering controlled forms, raw HTML, de-opt reconciliation, portals, and hydration.
  • The broader octane/octane-prod run passed 17,475 tests with one 5-second timeout under concurrent build load; that test passed in isolation in both projects (6/6 tests).
  • A deliberately broken checkbox membership guard failed the new regression in both modes; deliberately retained stale raw HTML failed the other new regression in both modes; both passed after restoration.
  • Frozen production baseline/candidate matched all eight semantic hashes in the paired benchmark. All six intended prototype locations report inherited hits on the candidate and misses on baseline; the raw HTML keys remain nonenumerable. The B–C–C–B lookup timings track control variation, so no throughput improvement is claimed.

Risk / follow-ups

The native DOM prototype initialization runs once per client realm. The local probe uses jsdom and does not measure browser DOM throughput; current-head CI will cover browser behavior. #981 remains open for other findings.

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
One-time mutation of native DOM prototypes affects all elements in a realm; behavior is covered by new tests but real browser impact is indirect (lookup path only).

Overview
Seeds hot DOM expando lookups on native prototypes so absent-property reads become inherited undefined hits after the first raw-HTML host or during de-opt child scans (#981).

initDomOperations now pre-seeds raw HTML ownership keys (__oct_dangerHTML and related child markers), the de-opt descriptor symbol, and the uncontrolled defaultValue baseline on Element / CharacterData prototypes. seedExpando accepts PropertyKey and can define non-enumerable slots so new keys do not show up in for...in over elements. defaultChecked is intentionally not seeded.

Adds a Node/jsdom dom-expando benchmark (baseline vs candidate, semantic hash checks) and regressions for pristine checkbox defaultChecked updates and mixed raw HTML + de-opt sibling reconciliation.

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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Sep 9, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review September 9, 2026 13:17
@domgan-oai
domgan-oai merged commit 593bf2e into octanejs:main Sep 9, 2026
50 checks passed
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