Repository navigation
perf: keep memo wrappers on stable shapes - #1014
Merged
domgan-oai merged 1 commit intoSep 9, 2026
Merged
Conversation
Closed
68 of 84 tasks
domgan-oai
marked this pull request as ready for review
September 9, 2026 12:46
14 of 21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memo()wrapper functions on stable V8 property shapes with shared metadata accessors and a private owner marker.defaultProps, nested wrappers, comparator behavior, and protection against a full static-hoisting HOC accidentally becoming a memo boundary. Add client/server regressions and a registered production benchmark.memo()wrapper finding.Why
On merged
main(1c28da5), V8 reports fast properties for only the firstmemo()wrapper; later wrappers enter dictionary mode because each getter/setter is a fresh function. The production baseline reproduces this in both runtimes. The new benchmark samples 128 and 1,024 distinct wrappers rather than the single wrapper inmemo-wall.Validation
pnpm format:files:checkfor all changed files;git diff --checkpnpm typecheckpnpm sync; changeset validationnode benchmarks/bench.mjs --quick memo-wrapper-shapespnpm test: the repository-wide run was stopped after unrelated browser suites failed; an isolated Aria case confirmed Chromium exits at launch with macOS Mach portPermission denied (1100), before executing the test. Current-head CI passed all 26 jobs, including browser integration and React parity; Cursor Bugbot passed without findings.Risk / follow-ups
defaultPropsaccessor descriptor to an unrelated function must also copytypefor live forwarding. Full static hoisting remains covered by regressions; an isolated descriptor copy used to retain the original component through a per-wrapper closure.Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core
memo()metadata on both runtimes; behavior is heavily regression-tested, but incorrect descriptor sharing could break memo detection, defaultProps forwarding, or HOC static copying.Overview
Client and server
memo()no longer attach fresh getter/setter closures on every wrapper. Each wrapper gets a privateMEMO_OWNERmarker, then reuses shared descriptors for__memo(owner-bound marker) anddefaultProps(live read/write viatype), so many distinct wrappers stay on the same hidden-class shape while static hoisting still cannot turn an copied HOC into a memo boundary.Adds the Node-only
memo-wrapper-shapesbenchmark (128/1,024 wrappers, client/server isolates, semantic hashes, V8 fast-property diagnostics) and wires it intobench.mjs, benchmark docs, and the MCP suite catalog. Client audit and SSR element tests cover distinct/nested memos, live defaults, and hoisted statics.Patch changeset for
octaneand@octanejs/mcp-server.Reviewed by Cursor Bugbot for commit aa172b5. Bugbot is set up for automated code reviews on this repo. Configure here.