[Backup] Experimentation of react-native-mmkv to store local backup config #1097
+171
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch is not meant to be merged. It is just an experimentation to understand the advantages, drawbacks and implications of react-native-mmkv.
Backup current implementation uses react-native-async-storage to store local backup config. I decided to store the FULL config (backup status, uploaded media list, media to upload list, ...) in ONE key as a stringified JSON object to avoid any state issue.
But this lead to multiples issues because the local backup config can take tens of MB when there are a lot of medias, so we have :
There are multiple solutions to these issues. Here I try react-native-mmkv instead of react-native-async-storage which is known to be very fast. It may be a quick win without changing the algorithm too much and benefiting the entire app.
In this branch, I only try react-native-mmkv with backup feature.
Performance result
We can see a 5x to 10x performance boost. UX is better. I do not understand the parsing differences and I do not know if they are relevant.
Other results
Tested