A project to compare performance between various databases on React Native.
You can install dependencies using yarn
yarn install
- npx expo run:android
- npx expo run:ios
Please ensure you have generated the native bindings before running the app.
- Open the
android
directory in Android Studio. - It will take some time to sync and build gradle dependencies.
- Select
Build
in the top menu > SelectBuild Variant
. - Change the
:app
active build variant torelease
. - Run the app using the default configuration.
- Click on the
Logcat
option in the bottom tool window (under the Run button). - You can use the
package:mine
filter in the filter bar to filter the results. - Once all the benchmarks are done running, it will print out the results in the log for all the tests in a CSV format.
- Open the
ios/reactnativedatabasebenchmarks.xcworkspace
in xcode. - Edit the scheme and choose the
Release
build configuration for the run. - Click the play button to run the app.
- Does not measure UI performance during database operations yet.
- Only a single run of each test is recorded.
- No UI yet - all results are logged to the console.
- Does not test concurrent operations.
OP SQLite can be run using a performance mode fla set in the package.json
file. Using the following commands to set this up for the project. This must be done before the project is built.
1
is thread unsafe, you should only use transactions but will be the fastest option for single operations. 2
is thread-safe and marginally slower.
"op-sqlite": {
"performanceMode": "2"
}
Expo sqlite does not support batching of queries out the box. Prepared statements are used to achieve functionality simillar to batching.
yarn remove @powersync/react-native-quick-sqlite
yarn add react-native-quick-sqlite
- From Expo 51 onwards a patch is required to compile RNQS
yarn patch-package
- Comment out the code in the file referencing PowersyncSqliteAdapter which includes
adapters/powersync-sqlite-adapter.ts
. Also comment out lines 6, 23 and 27 inApp.tsx
. - Uncomment out the code referencing react-native-quick-sqlite (line 6 onwards) in
adapters/rn-quick-sqlite-adapter.ts
and lines 13, 24 and 29 inApp.tsx
. - You can follow the inverse of the above steps to test the powersync fork of react-native-quick-sqlite