Replace merge commit scheduling with a run loop observer (#56726)#56726
Open
j-piasecki wants to merge 1 commit intofacebook:mainfrom
Open
Replace merge commit scheduling with a run loop observer (#56726)#56726j-piasecki wants to merge 1 commit intofacebook:mainfrom
j-piasecki wants to merge 1 commit intofacebook:mainfrom
Conversation
|
@j-piasecki has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104227839. |
94d33e3 to
0c5c210
Compare
j-piasecki
added a commit
to j-piasecki/react-native
that referenced
this pull request
May 8, 2026
) Summary: Changelog: [IOS][CHANGED] - Drain React-revision merges from a `BeforeWaiting` main run loop observer instead of dispatching each merge as a separate main-queue block With Fabric commit branching (`enableFabricCommitBranching`), React commits land on a forked `currentReactRevision_` and are merged into the main branch later via `ShadowTree::mergeReactRevision()`. On iOS, the `schedulerShouldMergeReactRevision:` callback used to do a plain `RCTExecuteOnMainQueue` per promotion, so every promotion enqueued a fresh main queue block that competed for ordering with mount blocks dispatched from concurrent commits with `mountSynchronously=true`. Instead of dispatching each merge as its own main-queue block, enqueue the surface id into an `unordered_set<SurfaceId>` and drain it from a `MainRunLoopObserver` registered at `kCFRunLoopBeforeWaiting`. The merge calls `ShadowTree::commit(..., mountSynchronously = true)`, so the mount completes inline before the observer returns. A similar mechanism has already been implemented on Android in D100966623 Reviewed By: javache Differential Revision: D104227839
0c5c210 to
3b290ea
Compare
) Summary: Changelog: [IOS][CHANGED] - Drain React-revision merges from a `BeforeWaiting` main run loop observer instead of dispatching each merge as a separate main-queue block With Fabric commit branching (`enableFabricCommitBranching`), React commits land on a forked `currentReactRevision_` and are merged into the main branch later via `ShadowTree::mergeReactRevision()`. On iOS, the `schedulerShouldMergeReactRevision:` callback used to do a plain `RCTExecuteOnMainQueue` per promotion, so every promotion enqueued a fresh main queue block that competed for ordering with mount blocks dispatched from concurrent commits with `mountSynchronously=true`. Instead of dispatching each merge as its own main-queue block, enqueue the surface id into an `unordered_set<SurfaceId>` and drain it from a `MainRunLoopObserver` registered at `kCFRunLoopBeforeWaiting`. The merge calls `ShadowTree::commit(..., mountSynchronously = true)`, so the mount completes inline before the observer returns. A similar mechanism has already been implemented on Android in D100966623 Reviewed By: javache Differential Revision: D104227839
3b290ea to
5097abd
Compare
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:
Changelog: [IOS][CHANGED] - Drain React-revision merges from a
BeforeWaitingmain run loop observer instead of dispatching each merge as a separate main-queue blockWith Fabric commit branching (
enableFabricCommitBranching), React commits land on a forkedcurrentReactRevision_and are merged into the main branch later viaShadowTree::mergeReactRevision(). On iOS, theschedulerShouldMergeReactRevision:callback used to do a plainRCTExecuteOnMainQueueper promotion, so every promotion enqueued a fresh main queue block that competed for ordering with mount blocks dispatched from concurrent commits withmountSynchronously=true.Instead of dispatching each merge as its own main-queue block, enqueue the surface id into an
unordered_set<SurfaceId>and drain it from aMainRunLoopObserverregistered atkCFRunLoopBeforeWaiting. The merge callsShadowTree::commit(..., mountSynchronously = true), so the mount completes inline before the observer returns.A similar mechanism has already been implemented on Android in D100966623
Reviewed By: javache
Differential Revision: D104227839