Repository navigation
Conversation
`UpdatesRegistry::collectProps` runs under the registry lock. It copied the whole registry map, then each value into `RawProps`, then the new vector into the props map. It now copies each value once, in the same order for each family.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Change: Refactor Merge Risk: ⚪ Minimal · up to
|
BruceBotterson
left a comment
There was a problem hiding this comment.
I found no problems.
- The removed copy of
updatesRegistry_protected nothing: the caller must hold the manager lock (assert atUpdatesRegistry.cpp:185), both callers do (UpdatesRegistryManager.cpp:100-107,ReanimatedModuleProxy.cpp:798), and the loop does not change the registry. emplace_back(props)compiles with theexplicit RawProps(folly::dynamic)constructor. Eachfolly::dynamicis still copied once per entry.operator[]gives the samePropsMapcontents as the old find-or-emplace code.constis safe:collectPropsis not virtual.- The changelog fragment holds one sentence.
Note
This pull request was authored by AI on behalf of @pawicao.
Summary
UpdatesRegistry::collectPropsruns under the registry lock in every React commit hook and in every registry flush, and the UI thread takes the same lock on each frame. It copied each animated props object three times: it copied the whole registry map, then each value intoRawProps, then the new vector into the props map. The map copy dates from before the function asserted the lock, so it protected nothing. I dropped it and emplace each value into the props map directly, so each value is copied once and the order of values per family stays the same. I also made the functionconst, because it now only reads the registry.Test plan
Release build on a Pixel 9a, a React commit every 100 ms over N animated views, sync props off,
DISABLE_COMMIT_PAUSING_MECHANISM: true, 4 runs per build in ABBA order, measured on top of #10631 (median):collectPropsp50Changelog
yarn changelog:addfor each changed package, or this PR does not changereact-native-reanimatedorreact-native-worklets.