Skip to content

Commit 3f98c8e

Browse files
NikoArifacebook-github-bot
authored andcommitted
Avoid full copy of large folly::dynamic objects by switching to std::move semantics (#33621)
Summary: Problem: Current creation of ModuleConfig does a full copy of folly::dynamic object, which for large objects can cause 1000's of memory allocations, and thus increasing app's memory footprint and speed. Fix: Use std::move semantics to avoid copy of folly::dynamic, thus avoiding memory allocations. ## Changelog [General] [Fixed] - Avoid full copy of large folly::dynamic objects by switching to std::move semantics Pull Request resolved: #33621 Test Plan: Compiled React Native for Windows Consumed into Microsoft Excel App Tested functionality through Microsoft Office Excel App Viewed Memory Allocations in Debugger Reviewed By: cortinico Differential Revision: D35599759 Pulled By: RSNara fbshipit-source-id: 095a961422cca4655590d2283f6955472f1f0410
1 parent 70fcab7 commit 3f98c8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ReactCommon/cxxreact/ModuleRegistry.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ folly::Optional<ModuleConfig> ModuleRegistry::getConfig(
189189
// no constants or methods
190190
return folly::none;
191191
} else {
192-
return ModuleConfig{index, config};
192+
return ModuleConfig{index, std::move(config)};
193193
}
194194
}
195195

0 commit comments

Comments
 (0)