Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Migrate from AsyncStorage to MMKV #25

Closed
DavideSegullo opened this issue Feb 8, 2023 · 5 comments · Fixed by #26, #27, #28, #29 or #31
Closed

Migrate from AsyncStorage to MMKV #25

DavideSegullo opened this issue Feb 8, 2023 · 5 comments · Fixed by #26, #27, #28, #29 or #31
Assignees
Labels
enhancement New feature or request rn-keyring Issue related to rn-keyring package

Comments

@DavideSegullo
Copy link
Contributor

We can improve performance by migrating from AsyncStorage to MMKV

@DavideSegullo DavideSegullo added enhancement New feature or request rn-keyring Issue related to rn-keyring package labels Feb 8, 2023
@DavideSegullo DavideSegullo self-assigned this Feb 8, 2023
@DavideSegullo
Copy link
Contributor Author

We should use the new version https://github.com/mrousavy/react-native-mmkv/releases/tag/v2.7.0, so we can use fastWrites to avoid storage overflow

@giorgionocera
Copy link

Nice! Have you checked for any safety side effects?

@DavideSegullo
Copy link
Contributor Author

Nice! Have you checked for any safety side effects?

Do you mean about memory management and external access to it? All the data are stored inside a key-value storage, each value related to the keyring is encrypted.

I was talking about fastWrites:

2.7.0 adds a new prop to the MMKV configuration that changes the behaviour of set calls.

When fastWrites is set to true, MMKV does not overwrite previous values when calling set. This is faster, but uses more memory.
When fastWrites is set to false, MMKV deletes the previous value before calling set. This makes sure the storage size is always as small as possible, with the added performance cost of one delete call before setting.
Before this version, MMKV behaved as if fastWrites was set to true (i.e.; fast, but use more memory). Now after this PR, fastWrites is false by default, because users were complaining in mrousavy/react-native-mmkv#440 that the storage size grows too big.

I think we prefer a slower behaviour then a faster one, because memory management can be critical.

@giorgionocera what do you think?

@giorgionocera
Copy link

Okay, now it is clear :D
We should use the fastWrites=false configuration parameter. I agree with you ;)

DavideSegullo added a commit that referenced this issue Feb 14, 2023
added MMKV storage as replacement for AsyncStorage.

#25
@DavideSegullo DavideSegullo linked a pull request Feb 16, 2023 that will close this issue
DavideSegullo pushed a commit that referenced this issue Feb 21, 2023
# [1.0.0-next.6](rn-keyring-v1.0.0-next.5...rn-keyring-v1.0.0-next.6) (2023-02-21)

### Features

* **rn-keyring:** ✨ add MMKV storage ([8db7795](8db7795)), closes [#25](#25)
* **rn-keyring:** ✨ add storageId class property ([78ab185](78ab185))
@DavideSegullo
Copy link
Contributor Author

A couple of days ago I found out that there was a revert of this modification.

Not understanding why, as it was not documented, I asked on twitter.

In short, it was a false bug and the change to the source slowed down the code unnecessarily:

image

So we need to upgrade to a newer version, thus reversing the change proposed in this issue.

@DavideSegullo DavideSegullo reopened this Mar 2, 2023
@DavideSegullo DavideSegullo linked a pull request May 5, 2023 that will close this issue
DavideSegullo pushed a commit that referenced this issue May 5, 2023
# [1.0.0-next.2](utils-v1.0.0-next.1...utils-v1.0.0-next.2) (2023-05-05)

### Features

* ⬆️ migrate to nx 16 ([a3212dd](a3212dd))
* ⬆️ upgrade cosmjs deps ([e660395](e660395))
* ⬆️ upgrade mmkv dep ([07bcc00](07bcc00))
* ⬆️ upgrade mobx dep ([d8ada0b](d8ada0b))
* ⬆️ upgrade noble and scure deps ([bdc5b3c](bdc5b3c))
* ⬆️ upgrade rn dep ([9e9b049](9e9b049))
* ➕ add @theunderscorer/nx-semantic-release dep ([44e89fc](44e89fc))
* **rn-keyring:** ✨ add MMKV storage ([8db7795](8db7795)), closes [#25](#25)
* **rn-keyring:** ✨ change react-native-mmkv to remove fastWrites prop ([bbfc0dd](bbfc0dd)), closes [#25](#25)
DavideSegullo pushed a commit that referenced this issue May 5, 2023
# [1.0.0-next.6](keyring-v1.0.0-next.5...keyring-v1.0.0-next.6) (2023-05-05)

### Features

* ⬆️ migrate to nx 16 ([a3212dd](a3212dd))
* ⬆️ upgrade cosmjs deps ([e660395](e660395))
* ⬆️ upgrade mmkv dep ([07bcc00](07bcc00))
* ⬆️ upgrade mobx dep ([d8ada0b](d8ada0b))
* ⬆️ upgrade noble and scure deps ([bdc5b3c](bdc5b3c))
* ⬆️ upgrade rn dep ([9e9b049](9e9b049))
* ➕ add @theunderscorer/nx-semantic-release dep ([44e89fc](44e89fc))
* **rn-keyring:** ✨ add MMKV storage ([8db7795](8db7795)), closes [#25](#25)
* **rn-keyring:** ✨ change react-native-mmkv to remove fastWrites prop ([bbfc0dd](bbfc0dd)), closes [#25](#25)
DavideSegullo pushed a commit that referenced this issue May 5, 2023
# [1.0.0-next.7](rn-keyring-v1.0.0-next.6...rn-keyring-v1.0.0-next.7) (2023-05-05)

### Features

* ⬆️ migrate to nx 16 ([a3212dd](a3212dd))
* ⬆️ upgrade cosmjs deps ([e660395](e660395))
* ⬆️ upgrade mmkv dep ([07bcc00](07bcc00))
* ⬆️ upgrade mobx dep ([d8ada0b](d8ada0b))
* ⬆️ upgrade noble and scure deps ([bdc5b3c](bdc5b3c))
* ⬆️ upgrade rn dep ([9e9b049](9e9b049))
* ➕ add @theunderscorer/nx-semantic-release dep ([44e89fc](44e89fc))
* **rn-keyring:** ✨ change react-native-mmkv to remove fastWrites prop ([bbfc0dd](bbfc0dd)), closes [#25](#25)
DavideSegullo pushed a commit that referenced this issue May 5, 2023
# [1.0.0-next.3](bip85-v1.0.0-next.2...bip85-v1.0.0-next.3) (2023-05-05)

### Features

* ⬆️ migrate to nx 16 ([a3212dd](a3212dd))
* ⬆️ upgrade cosmjs deps ([e660395](e660395))
* ⬆️ upgrade mmkv dep ([07bcc00](07bcc00))
* ⬆️ upgrade mobx dep ([d8ada0b](d8ada0b))
* ⬆️ upgrade noble and scure deps ([bdc5b3c](bdc5b3c))
* ⬆️ upgrade rn dep ([9e9b049](9e9b049))
* ➕ add @theunderscorer/nx-semantic-release dep ([44e89fc](44e89fc))
* **rn-keyring:** ✨ add MMKV storage ([8db7795](8db7795)), closes [#25](#25)
* **rn-keyring:** ✨ change react-native-mmkv to remove fastWrites prop ([bbfc0dd](bbfc0dd)), closes [#25](#25)
DavideSegullo pushed a commit that referenced this issue May 5, 2023
# [1.0.0-next.2](rn-bip85-v1.0.0-next.1...rn-bip85-v1.0.0-next.2) (2023-05-05)

### Features

* ⬆️ migrate to nx 16 ([a3212dd](a3212dd))
* ⬆️ upgrade cosmjs deps ([e660395](e660395))
* ⬆️ upgrade mmkv dep ([07bcc00](07bcc00))
* ⬆️ upgrade mobx dep ([d8ada0b](d8ada0b))
* ⬆️ upgrade noble and scure deps ([bdc5b3c](bdc5b3c))
* ⬆️ upgrade rn dep ([9e9b049](9e9b049))
* ➕ add @theunderscorer/nx-semantic-release dep ([44e89fc](44e89fc))
* **rn-keyring:** ✨ add MMKV storage ([8db7795](8db7795)), closes [#25](#25)
* **rn-keyring:** ✨ change react-native-mmkv to remove fastWrites prop ([bbfc0dd](bbfc0dd)), closes [#25](#25)
DavideSegullo pushed a commit that referenced this issue May 6, 2023
# [1.0.0-next.2](wif-v1.0.0-next.1...wif-v1.0.0-next.2) (2023-05-06)

### Bug Fixes

* **wif:** 🐛 fix package main ([fe070ef](fe070ef))
* **wif:** 🔧 fix semantic release config ([a65e17d](a65e17d))

### Features

* ⬆️ migrate to nx 16 ([a3212dd](a3212dd))
* ⬆️ upgrade cosmjs deps ([e660395](e660395))
* ⬆️ upgrade mmkv dep ([07bcc00](07bcc00))
* ⬆️ upgrade mobx dep ([d8ada0b](d8ada0b))
* ⬆️ upgrade noble and scure deps ([bdc5b3c](bdc5b3c))
* ⬆️ upgrade rn dep ([9e9b049](9e9b049))
* ➕ add @theunderscorer/nx-semantic-release dep ([44e89fc](44e89fc))
* ➕ add quick crypto and buffer deps ([a7b578c](a7b578c))
* **demo:** ✨ add example demo ([cf32f63](cf32f63))
* **keyring:** ✨ add basic setup for mobx and removed hash field ([c567e43](c567e43)), closes [#4](#4)
* **rn-keyring:** ✨ add MMKV storage ([8db7795](8db7795)), closes [#25](#25)
* **rn-keyring:** ✨ change react-native-mmkv to remove fastWrites prop ([bbfc0dd](bbfc0dd)), closes [#25](#25)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.