Skip to content

perf(text): experiment text optimizations (RN #59063, #59064) - #60

Draft
kosmydel wants to merge 3 commits into
0.86.0-discordfrom
kosmydel/text-optimizations-experiment
Draft

kosmydel wants to merge 3 commits into
0.86.0-discordfrom
kosmydel/text-optimizations-experiment

Conversation

@kosmydel

@kosmydel kosmydel commented Oct 16, 2026 •

Copy link
Copy Markdown

Description

Backports two open upstream text perf PRs by tomekzaw behind a new numeric feature flag discordTextOptimization (default 0), so the Discord app can A/B them:

  • 1: react/react-native#59063. Unchanged Text siblings keep their attributed string and measured layouts when Yoga clones them, which avoids per-sibling state updates, setText and re-layout.
  • 2: 1 + react/react-native#59064. Skips the unused Layout.getDesiredWidth pass in Android TextLayoutManager.createLayout.

With the flag at 0, both code paths behave exactly as before.

Note

The Discord app side (libdiscore experiment 2026-10-android-text-optimization driving the flag on Android) is in https://github.com/discord/discord/pull/329378.

Test steps

  1. CI: ReactAndroid unit tests (com.facebook.react.views.text.*), C++ build.
  2. In the app, set treatment 0/1/2 and verify text renders identically (chat, settings, RTL/Arabic text, font scaling changes).
  3. Profile "change one item in a list of many Texts" and compare UI-thread updateState/setText counts between 0 and 1.

Made with Cursor

kosmydel and others added 3 commits October 16, 2026 11:25
0 = none, 1 = keep paragraph content across unchanged clones,
2 = 1 + skip unused getDesiredWidth on Android.

Co-authored-by: Cursor <cursoragent@cursor.com>
…lones

Backport of react#59063 (tomekzaw), gated behind
discordTextOptimization >= 1.

Co-authored-by: Cursor <cursoragent@cursor.com>
Backport of react#59064 (tomekzaw), gated behind
discordTextOptimization >= 2.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kosmydel kosmydel changed the title perf(text): experiment gate tomekzaw text optimizations (#59063, #59064) perf(text): experiment text optimizations (RN #59063, #59064) Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant