mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
Fabric: Using move semanic in Differentiator
Summary: Diffing is already pretty fast, but using move semantic should make it even faster. ShadowViews have shared pointers, so moving them can save us atomic counter bumps. Reviewed By: mdvacca Differential Revision: D15200496 fbshipit-source-id: 6fb0eb79e07cd6ae9b3100713497c634f306bc18
This commit is contained in:
committed by
Facebook Github Bot
parent
4a1d532674
commit
30c3ea5c3f
@@ -46,7 +46,7 @@ static void sliceChildShadowNodeViewPairsRecursively(
|
||||
|
||||
static ShadowViewNodePairList sliceChildShadowNodeViewPairs(
|
||||
const ShadowNode &shadowNode) {
|
||||
ShadowViewNodePairList pairList;
|
||||
auto pairList = ShadowViewNodePairList{};
|
||||
sliceChildShadowNodeViewPairsRecursively(pairList, {0, 0}, shadowNode);
|
||||
return pairList;
|
||||
}
|
||||
@@ -195,22 +195,34 @@ static void calculateShadowViewMutations(
|
||||
}
|
||||
|
||||
// All mutations in an optimal order:
|
||||
mutations.insert(
|
||||
mutations.end(),
|
||||
std::move(
|
||||
destructiveDownwardMutations.begin(),
|
||||
destructiveDownwardMutations.end());
|
||||
mutations.insert(
|
||||
mutations.end(), updateMutations.begin(), updateMutations.end());
|
||||
mutations.insert(
|
||||
mutations.end(), removeMutations.rbegin(), removeMutations.rend());
|
||||
mutations.insert(
|
||||
mutations.end(), deleteMutations.begin(), deleteMutations.end());
|
||||
mutations.insert(
|
||||
mutations.end(), createMutations.begin(), createMutations.end());
|
||||
mutations.insert(
|
||||
mutations.end(), downwardMutations.begin(), downwardMutations.end());
|
||||
mutations.insert(
|
||||
mutations.end(), insertMutations.begin(), insertMutations.end());
|
||||
destructiveDownwardMutations.end(),
|
||||
std::back_inserter(mutations));
|
||||
std::move(
|
||||
updateMutations.begin(),
|
||||
updateMutations.end(),
|
||||
std::back_inserter(mutations));
|
||||
std::move(
|
||||
removeMutations.rbegin(),
|
||||
removeMutations.rend(),
|
||||
std::back_inserter(mutations));
|
||||
std::move(
|
||||
deleteMutations.begin(),
|
||||
deleteMutations.end(),
|
||||
std::back_inserter(mutations));
|
||||
std::move(
|
||||
createMutations.begin(),
|
||||
createMutations.end(),
|
||||
std::back_inserter(mutations));
|
||||
std::move(
|
||||
downwardMutations.begin(),
|
||||
downwardMutations.end(),
|
||||
std::back_inserter(mutations));
|
||||
std::move(
|
||||
insertMutations.begin(),
|
||||
insertMutations.end(),
|
||||
std::back_inserter(mutations));
|
||||
}
|
||||
|
||||
ShadowViewMutationList calculateShadowViewMutations(
|
||||
@@ -221,7 +233,8 @@ ShadowViewMutationList calculateShadowViewMutations(
|
||||
// Root shadow nodes must be belong the same family.
|
||||
assert(ShadowNode::sameFamily(oldRootShadowNode, newRootShadowNode));
|
||||
|
||||
ShadowViewMutationList mutations;
|
||||
auto mutations = ShadowViewMutationList{};
|
||||
mutations.reserve(256);
|
||||
|
||||
auto oldRootShadowView = ShadowView(oldRootShadowNode);
|
||||
auto newRootShadowView = ShadowView(newRootShadowNode);
|
||||
|
||||
Reference in New Issue
Block a user