Fabric: Small optimization in RCTMountingManager

Summary: `pullTransaction` can return an empty transaction. That's fine to interate over the empty collection and do nothing, but it's inneficient because we also call delegate methods around the loop (that can be expensive).

Reviewed By: sammy-SC

Differential Revision: D17053430

fbshipit-source-id: c78959d47ea22cd9bb99419f6a80de3ac8e89fd3
This commit is contained in:
Valentin Shergin authored and Facebook Github Bot committed 2019-08-28 21:10:25 -07:00
1 parent 33112a1c20
commit 28d26c2e56
1 file changed
+6 -1
+6 -1
View File
@@ -251,10 +251,15 @@ static void RNPerformMountInstructions(ShadowViewMutationList const &mutations,
}
auto surfaceId = transaction->getSurfaceId();
auto &mutations = transaction->getMutations();
if (mutations.size() == 0) {
return;
}
RCTAssertMainQueue();
[self.delegate mountingManager:self willMountComponentsWithRootTag:surfaceId];
RNPerformMountInstructions(transaction->getMutations(), self.componentViewRegistry);
RNPerformMountInstructions(mutations, self.componentViewRegistry);
[self.delegate mountingManager:self didMountComponentsWithRootTag:surfaceId];
}