镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Avoid ref overhead when not needed - #512

Open
ixf wants to merge 2 commits into
react:mainfrom
ixf:perf/refless-elements
Open

ixf wants to merge 2 commits into
react:mainfrom
ixf:perf/refless-elements

Conversation

@ixf

@ixf ixf commented Jul 23, 2026

Copy link
Copy Markdown

This reduces RSD's memory overhead in React Native. Measured with https://github.com/ixf/rsd-bench - in this bench it drops retained memory and render times by a couple percent (~5%)

  • useStrictDOMElement doesn't need to create a callback ref if no ref was passed to the component
  • replace useCallback + useElementCallback (useCallback + useRef) with one useMemo
  • reuse default props for images when no aspect ratio needs to be added

@meta-cla meta-cla Bot added the cla signed label Jul 23, 2026
@ixf ixf changed the title Avoid ref overhead when not needed; Avoid ref overhead when not needed Jul 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant