-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
191 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
Performance Benchmarks | ||
====================== | ||
This is an Android app to measure object persistence performance of ObjectBox, Realm, SQLite (with greenDAO as ORM). | ||
# ObjectBox Java Database Performance Benchmarks | ||
|
||
Results are printed on the UI and saved as .tsv files. | ||
The files are located in the external storage and can be easily imported into a spreadsheet. | ||
This is an Android app to measure object persistence performance of | ||
- [ObjectBox](/app/src/main/java/io/objectbox/performanceapp/objectbox) | ||
- [Realm](/app/src/main/java/io/objectbox/performanceapp/realm) | ||
- [SQLite using Room](/app/src/main/java/io/objectbox/performanceapp/room) | ||
- [SQLite using greenDAO](/app/src/main/java/io/objectbox/performanceapp/greendao) (deprecated) | ||
|
||
How to get good results | ||
----------------------- | ||
* Tests perform differently when multiple products are selected: | ||
Thus, for more representable results, you should only run a single product at a time. | ||
* Go into air plane mode to avoid background apps doing sync over the network | ||
* Screen must be on at all times (plug device in) | ||
* Beware of lazy loaded properties (e.g. live objects on Realm): | ||
loading objects seems very fast because no property data is actually loaded. | ||
Thus it makes more sense to also access properties (at least once) and look add up values for load+access. | ||
* Also consider general notes for [benchmarking on Android](http://greenrobot.org/android/benchmarking-on-android/) | ||
Results are printed on the UI and saved as tab-separated files (`.tvs`) that can be easily imported | ||
into a spreadsheet. The files are located on external storage. | ||
|
||
<img src="android-perf-screenshot.png" height="540"/> | ||
|
||
## How to get good results | ||
|
||
* Tests perform differently when multiple databases are selected: | ||
For comparable results, run only a single database at a time. | ||
* Put the test device into air plane mode to avoid background apps doing sync over the network. | ||
* Screen must be on at all times (e.g. plug the device in). | ||
* Beware of lazy loaded data (e.g. properties on live objects of Realm): | ||
loading objects may seem very fast because no data is actually loaded. | ||
For better comparison it may be necessary to access data (at least once) and combine load and access time to get actual read time. | ||
* We also have written some general notes on [benchmarking on Android](https://greenrobot.org/android/benchmarking-on-android/). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("io.objectbox") | ||
id("realm-android") | ||
} | ||
|
||
android { | ||
namespace = "io.objectbox.performanceapp" | ||
compileSdk = 34 // Android 14 | ||
|
||
buildFeatures { | ||
viewBinding = true | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
defaultConfig { | ||
applicationId = "io.objectbox.performanceapp" | ||
minSdk = 19 // Android 4.4 | ||
targetSdk = 34 // Android 14 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
javaCompileOptions { | ||
annotationProcessorOptions { | ||
arguments(mapOf("room.schemaLocation" to "$projectDir/schemas")) | ||
} | ||
} | ||
} | ||
|
||
buildTypes { | ||
getByName("release") { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") | ||
signingConfig = signingConfigs.getByName("debug") | ||
} | ||
create("releaseDebugCert") { | ||
initWith(getByName("release")) | ||
// Just to use without checkjni | ||
signingConfig = signingConfigs.getByName("debug") | ||
} | ||
create("debugJniNoDebug") { | ||
initWith(getByName("debug")) | ||
// Just to use without checkjni | ||
isJniDebuggable = false | ||
} | ||
} | ||
} | ||
|
||
// Print deprecation warnings like Kotlin | ||
tasks.withType(JavaCompile::class).configureEach { | ||
options.isDeprecation = true | ||
} | ||
|
||
dependencies { | ||
implementation("androidx.preference:preference:1.2.1") | ||
implementation("androidx.room:room-runtime:2.6.1") | ||
annotationProcessor("androidx.room:room-compiler:2.6.1") | ||
implementation("org.greenrobot:greendao:3.3.0") | ||
implementation("org.greenrobot:essentials:3.1.0") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.