Android Database Performance Benchmarks

Overview

Check out our new performance test app that includes ObjectBox.

Android Database Performance Benchmark

This project evaluates Android databases and related persistence solutions. It tests SQLite, SQLite in combination with several ORMs, and alternative database options.

Build Status

Usage

To run the Android instrumentation tests make sure to set RUN_PERFORMANCE_TESTS in Common\build.gradle to true.

To run with Android Studio, create a new Android Instrumented Tests run configuration. Specify the desired PerfTest<x> class and a test method (see BasePerfTestCase).

More Open Source by greenrobot

ObjectBox is a new and fast object-oriented database for mobile devices.

greenDAO is an ORM optimized for Android: it maps database tables to Java objects and uses code generation for optimal speed.

EventBus is a central publish/subscribe bus for Android with optional delivery threads, priorities, and sticky events. A great tool to decouple components (e.g. Activities, Fragments, logic components) from each other.

greenrobot-common is a set of utility classes and hash functions for Android & Java projects.

Follow us on Google+ to stay up to date.

Comments
  • Sqlcipher support

    Sqlcipher support

    I added SQLCipher support and tests are the same as SQLite except two differences:

    1. getWritableDatabase() now invokes with string argument, because SQLCipher requires password for database encryption.
    2. database.delete() method now uses empty array with whereArgs instead of null. Since this method does not check whether array is initialized or not, it directly checks for the length of the array.
    3. I fixed build failures that I encountered. I made minimal changes. As follows:

    First of all when I tried to build it and run the tests build was failing. I updated build Gradle to 4.3 and android plugin to 3.0.0. I also tried to keep 4.1 but I faced several build issues.

    Second. I have run all available tests and four of them are failing (not because of my changes), all others are running okay: Succeed: ActiveRecord DBFlow greenDAO OrmLite Realm
    requery Room
    SQLCipher
    SQLDelight Sqlite squidb

    Failed: Couchbase
    Cupboard
    Firebase
    Parse

    opened by raiym 8
  • Update to SQL Delight 0.4.4

    Update to SQL Delight 0.4.4

    We added native support for short because we saw you were trying to use them (aside: dear god why shorts????). The docs never should have said short was supported because literally 0 people should be using it (hence why we didn't support it).

    opened by JakeWharton 4
  • Add additional libs to comparision

    Add additional libs to comparision

    • DbFlow https://github.com/Raizlabs/DBFlow
    • SQLDelight https://github.com/square/sqldelight
    • SquiDB https://github.com/yahoo/squidb
    • requery https://github.com/requery/requery
    opened by greenrobot 3
  • Benchmark tool

    Benchmark tool

    Added benchmark tool from greenDAO v3 that writes results to tab-separated output file (tsv).

    Issue: file can not be stored on external storage root on M+ due to new runtime permissions. So currently the results file is stored for each app inside its external storage files directory.

    opened by greenrobot-team 1
  • Occasional build breakage due to Realm

    Occasional build breakage due to Realm

    Tracked in https://github.com/realm/realm-java/issues/2502

    For now only building and skipping assembleAndroidTest.

    Execution failed for task ':Realm:transformClassesWithRealmTransformerForDebugAndroidTest'.
    > javassist.NotFoundException: io.realm.internal.RealmProxyMediator
    
    opened by greenrobot-team 1
  • Build updates

    Build updates

    • Update Android Plugin [2.3.3 -> 3.6.1], Gradle [4.1 -> 5.6.4].
    • Travis CI: add new license key, SDK 26 and build tools 28.0.3.
    • Increase Gradle heap memory size [512 MB -> 1,5 GB].
    • Use new dependency configurations.
    • SQLDelight: auto-value uses Java 8 features, use annotations artifact.
    opened by greenrobot-team 0
  • Updates 2017-09

    Updates 2017-09

    DO NOT MERGE

    • Update build tools.
    • Drop android-apt.
    • ~Add ObjectBox.~ postponed
    • Add Room.
    • Switch to new testing support library (except greenDAO).
    • Update SQLDelight. Will separate other updates to separate PR.
    opened by greenrobot-team 0
  • Requery update to 1.0.0-beta23

    Requery update to 1.0.0-beta23

    DO NOT MERGE

    Issues with R class generation.

    Stacktrace of build --stacktrace

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':requery:processDebugResources'.
    > java.io.FileNotFoundException: C:\Users\Uwe\greenrobot-git\db-perf\requery\build\intermediates\symbols\debug\R.txt (Das System kann die angegebene Datei nicht finden)
    
    * Try:
    Run with --info or --debug option to get more log output.
    
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':requery:processDebugResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:68)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
        at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\Uwe\greenrobot-git\db-perf\requery\build\intermediates\symbols\debug\R.txt (Das System kann die angegebene Datei nicht finden)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:203)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:82)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 70 more
    Caused by: java.io.FileNotFoundException: C:\Users\Uwe\greenrobot-git\db-perf\requery\build\intermediates\symbols\debug\R.txt (Das System kann die angegebene Datei nicht finden)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:126)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:116)
        at com.google.common.io.ByteSource$AsCharSource.openStream(ByteSource.java:435)
        at com.google.common.io.CharSource.getInput(CharSource.java:94)
        at com.google.common.io.CharSource.getInput(CharSource.java:65)
        at com.google.common.io.CharStreams.readLines(CharStreams.java:344)
        at com.google.common.io.Files.readLines(Files.java:741)
        at com.google.common.io.Files.readLines(Files.java:712)
        at com.android.builder.internal.SymbolLoader.load(SymbolLoader.java:69)
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:1032)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:163)
        ... 78 more
    
    opened by greenrobot-team 0
  • Travis improvements

    Travis improvements

    • Resolve PermGen memory issue (use JDK 8).
    • Improved emulator script.
    • Only build, do not run the performance tests on travis. Now can enable perf tests by default.
    • Only build to work around realm transformer failure (see #12)
    opened by greenrobot-team 0
  • Update existing tests

    Update existing tests

    This closes #2

    Updated the following libraries (#8):

    • greenDAO to 2.1.0 (on one comparison run, median run times are less than 3% lower, so about the same performance)
    • couchbase-lite to 1.2.0 (broken, throws 409 conflict with new transaction API, extracted to #9)
    • cupboard to 2.1.4
    • firebase-client-android to 2.5.1 (still OOM issues)
    • parse to 1.13 (only has minor fixes)
    • realm to 0.88.0 (now also uses annotation parsing with apt, is a gradle plugin)
    opened by greenrobot-team 0
  • Update couchbase test

    Update couchbase test

    DO NOT MERGE

    Transactions are removed in 1.2. They were previously accessible only inofficially. Now a transaction is started as soon as the database is openend. So nested transactions are no longer supported (or the "global" transaction would fail).

    Also the API to clear the document cache has been removed, now only happens if the database is closed.

    So not merging for now? (Batch tests are disabled in this branch.)

    -ut

    opened by greenrobot-team 0
Owner
Markus Junginger
CTO and co-founder at objectbox.io, creator of EventBus and greenDAO.
Markus Junginger
A key-value database for Android

SnappyDB SnappyDB is a key-value database for Android it's an alternative for SQLite if you want to use a NoSQL approach. It allows you to store and g

Nabil Hachicha 1.8k Dec 28, 2022
Insanely easy way to work with Android Database.

Sugar ORM Insanely easy way to work with Android databases. Official documentation can be found here - Check some examples below. The example applicat

null 2.6k Dec 16, 2022
Kodein-DB is a Kotlin/Multiplatform embedded NoSQL database that works on JVM, Android, Kotlin/Native and iOS.

Kodein-DB is a Kotlin/Multiplatform embedded NoSQL database that works on JVM, Android, Kotlin/Native and iOS. It is suited for client or mobile applications.

null 277 Dec 3, 2022
Test any type of cloud database on Android apps. No need of a dedicated backend.

Test any type of cloud database on Android apps. No need of a dedicated backend.

Arjun 9 May 9, 2022
Android with Real-time Database

Android with Real-time Database It was too much effort to build my own real-time database, but the result really satisfying, so it was worth it. Note

null 4 Jun 14, 2022
Realm is a mobile database: a replacement for SQLite & ORMs

Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Java version of Realm

Realm 11.4k Jan 9, 2023
ObjectBox is a superfast lightweight database for objects

ObjectBox Java (Kotlin, Android) ObjectBox is a superfast object-oriented database with strong relation support. ObjectBox is embedded into your Andro

ObjectBox 4.1k Dec 30, 2022
A helper library to help using Room with existing pre-populated database [].

Room now supports using a pre-packaged database out of the box, since version 2.2.0 https://developer.android.com/jetpack/androidx/releases/room#2.2.0

Ibrahim Eid 136 Nov 29, 2022
A library for reading Shared Preferences and Database values within the application.

AppDataReader A library for reading and writing Shared Preferences and Database values of the application within the device. Advantages of using this

Anshul Jain 124 Nov 25, 2022
A quick and easy database manager plugin library for your DBFlow databases.

DBFlowManager A quick and easy database manager and viewer plugin library for your DBFlow databases to view, insert, delete, update the tables directl

Wajahat Karim 26 Oct 21, 2022
Android library for viewing and sharing in app databases.

DbInspector DbInspector provides a simple way to view the contents of the in-app database for debugging purposes. There is no need to pull the databas

Infinum 925 Dec 17, 2022
A small library to help with Realm.IO integration in Android apps

Android Realm Asset Helper A small library of methods to help with Realm.IO integration in Android apps Copies a realm database from a the assets fold

Quality Mobile Puzzle Apps 29 Dec 28, 2021
A wrapper around Android's SQLiteDatabase with restoring capability

Restorable SQLiteDatabase RestorableSQLiteDatabase is a wrapper to replicate android's SQLiteDatabase class with restoring capability. This wrapper ma

Navid 21 Oct 21, 2022
A simple NoSQL client for Android. Meant as a document store using key/value pairs and some rudimentary querying. Useful for avoiding the hassle of SQL code.

SimpleNoSQL A simple NoSQL client for Android. If you ever wanted to just save some data but didn't really want to worry about where it was going to b

Colin Miller 389 Sep 25, 2022
an android library for debugging what we care about directly in app.

EN | 中文 Pandora is a tool box that allows you to inspect and modify what includes networks, databases, UIs, etc. directly in your application. It is s

linjiang 1.5k Dec 30, 2022
Core Data for Android

NexusData Core Data for Android NexusData is an object graph and persistence framework for Android. It allows for organizing and managing relational d

Dia Kharrat 71 Nov 11, 2022
🧬 Android DataBinding kit for notifying data changes from Model layers to UI layers on MVVM architecture.

?? Android DataBinding kit for notifying data changes from Model layers to UI layers on MVVM architecture.

Jaewoong Eum 276 Jan 5, 2023
Pref-DB - Android SharedPreferences alternative library

Pref-DB Android SharedPreferences alternative library.

M.Fakhri 5 Sep 14, 2022
A curated list of standards, tests and benchmarks that can be used for testing and evaluating dev-tools

A curated list of standards, tests and benchmarks that can be used for testing and evaluating dev tools Contribution Add the description of the benchm

null 13 Dec 16, 2022
An app performance monitor(APM) , like "Android Studio profiler", you can easily monitor the performance of your app real time in browser

AndroidGodEye English README.md 中文 README_zh.md Android developer lack of monitoring of performance data,especially in production environment. so we n

AndroidKy 2.5k Dec 29, 2022