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

Avoid ref overhead when not needed#512
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
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