Repository navigation
Conversation
javache
approved these changes
Nov 3, 2026
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D129355825. |
This branch has not been deployed
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:
When a Props constructor reads a key that isn't the next one in the prepared order,
RawPropsParser::atwalked the cursor roundkeys_one key at a time until it hit it. That happens on every parse for props that extendViewPropsand read one of View's keys again (width,backgroundColor, ...), costing up to one comparison per registered key. The parser already keepsnameToIndex_forpreparse, so now a miss on the next key looks the key up there and moves the cursor to its index. In-order reads are unchanged.A key that was never seen while preparing now returns
nullptrin release builds too, instead of looping forever.Fixes #59759
Changelog:
[GENERAL] [CHANGED] - Props parsing looks up props read out of order by name instead of scanning every key
Test Plan:
Built
RawPropsTest.cpp(minus the Hermes test) against this change with Homebrew folly/gtest on macOS: all tests pass in debug. In a release build, reading an unknown key returnsnullptrwith this change and hangs on main.A small benchmark with a 100-key Props struct that re-reads two keys after the in-order pass, 200k parses in release: 222 ms on main, 191 ms with this change.
scripts/clang-formatis clean. Not run on a device.