Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid full copy of large folly::dynamic objects by switching to std::move semantics #33621

Closed
wants to merge 1 commit into from

Conversation

NikoAri
Copy link
Contributor

@NikoAri NikoAri commented Apr 12, 2022

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

Test Plan

Compiled React Native for Windows
Consumed into Microsoft Excel App
Tested functionality through Microsoft Office Excel App
Viewed Memory Allocations in Debugger

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 impacts memory footprint and perf.

Fix:
Use std::move semantics to avoid copy of folly::dynamic, thus avoiding memory allocations.
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Microsoft Partner: Microsoft Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Apr 12, 2022
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 46ab59c
Branch: main

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,773,873 -12
android hermes armeabi-v7a 7,179,764 -59
android hermes x86 8,083,112 +43
android hermes x86_64 8,061,683 +7
android jsc arm64-v8a 9,646,881 -11
android jsc armeabi-v7a 8,421,159 -54
android jsc x86 9,596,168 +49
android jsc x86_64 10,193,524 +9

Base commit: 46ab59c
Branch: main

@facebook-github-bot
Copy link
Contributor

@RSNara has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @NikoAri in 3f98c8e.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Apr 13, 2022
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2023
…move semantics (facebook#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: facebook#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Microsoft Partner: Microsoft Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants