Skip getProperty calls for unreferenced props in RawPropsParser (#45456)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45456

Small perf improvement when using enableCppPropsIteratorSetter

Changelog: [Internal]

Reviewed By: sammy-SC, mdvacca

Differential Revision: D59699469

fbshipit-source-id: d65a5e26faf218d0b79c9ac691007310b6db4182
This commit is contained in:
Pieter De Baets
2024-07-16 04:38:45 -07:00
committed by Facebook GitHub Bot
parent b443e37a02
commit e02ca334b1
@@ -125,10 +125,7 @@ void RawPropsParser::preparse(const RawProps& rawProps) const noexcept {
for (size_t i = 0; i < count; i++) {
auto nameValue = names.getValueAtIndex(runtime, i).getString(runtime);
auto value = object.getProperty(runtime, nameValue);
auto name = nameValue.utf8(runtime);
auto keyIndex = nameToIndex_.at(
name.data(), static_cast<RawPropsPropNameLength>(name.size()));
@@ -137,6 +134,8 @@ void RawPropsParser::preparse(const RawProps& rawProps) const noexcept {
}
rawProps.keyIndexToValueIndex_[keyIndex] = valueIndex;
auto value = object.getProperty(runtime, nameValue);
rawProps.values_.push_back(
RawValue(jsi::dynamicFromValue(runtime, value)));
valueIndex++;