mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Using traitCast in Differentiator
Summary: The Diffing is one of the hottest pieces of Fabric. Removing dynamic_cast here should improve perf. See the previous diff for more details. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D20052030 fbshipit-source-id: 27fd9f34f2a1f9d22b9da6b1e3c1a2982045c07a
This commit is contained in:
committed by
Facebook Github Bot
parent
fa773a1446
commit
b9e5ebd640
@@ -83,11 +83,13 @@ static void sliceChildShadowNodeViewPairsRecursively(
|
||||
ShadowViewNodePair::List &pairList,
|
||||
Point layoutOffset,
|
||||
ShadowNode const &shadowNode) {
|
||||
for (auto const &childShadowNode : shadowNode.getChildren()) {
|
||||
auto shadowView = ShadowView(*childShadowNode);
|
||||
for (auto const &sharedChildShadowNode : shadowNode.getChildren()) {
|
||||
auto &childShadowNode = *sharedChildShadowNode;
|
||||
auto shadowView = ShadowView(childShadowNode);
|
||||
|
||||
auto layoutableShadowNode =
|
||||
traitCast<LayoutableShadowNode const *>(&childShadowNode);
|
||||
|
||||
auto const layoutableShadowNode =
|
||||
dynamic_cast<LayoutableShadowNode const *>(childShadowNode.get());
|
||||
#ifndef ANDROID
|
||||
// New approach (iOS):
|
||||
// Non-view components are treated as layout-only views (they aren't
|
||||
@@ -102,10 +104,10 @@ static void sliceChildShadowNodeViewPairsRecursively(
|
||||
sliceChildShadowNodeViewPairsRecursively(
|
||||
pairList,
|
||||
layoutOffset + shadowView.layoutMetrics.frame.origin,
|
||||
*childShadowNode);
|
||||
childShadowNode);
|
||||
} else {
|
||||
shadowView.layoutMetrics.frame.origin += layoutOffset;
|
||||
pairList.push_back({shadowView, childShadowNode.get()});
|
||||
pairList.push_back({shadowView, &childShadowNode});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user