Awesome
Storage Benchmarks
This is a benchmark app to compare popular storage solutions for React Native.
It's running React Native 0.68, with Hermes enabled.
The Benchmark consists of calling a get operation (retrieve one value from the database) a thousand times.
Here are the results, ranked from fastest to slowest:
- react-native-mmkv: 12ms 👑
- WatermelonDB: 53ms
- RealmDB: 81ms
- react-native-quick-sqlite: 82ms
- AsyncStorage: 242ms
MMKV is 20x faster than AsyncStorage (slowest), and 4x faster than WatermelonDB (second fastest)!
<div align="center"> <img src="./img/graph.png" align="center" /> </div>Output in the console:
<div align="center"> <img src="./img/comparison.png" align="center" /> </div>Tested on an iPhone 11 Pro, Hermes, Debug
Run it
- Clone the repo and navigate to the
app/
directory - Run
yarn
- Run
yarn pods
- Run
yarn ios --device "YOURPHONENAME"
You can also omit the --device "YOURPHONENAME"
flag, but running on a Simulator always gives different results than on an actual device.
JS Engine
The benchmark project currently uses Hermes. To benchmark using JSC instead, set enable_hermes
to false
in the Podfile
.
Hardware
The above results were tested on an iPhone 11 Pro. Results may differ on different iPhones or Android Phones.
Debug
The above results were tested in a debug build. Release mode builds come with many optimizations and are therefore faster than debug.
Operations
The above results were tested using get operations for a single string key (value: 'hello'
). Results may differ when using other operations, such as set, delete, update, and more.