Skip to content

Android application for benchmarking ORMLite and GreenDao against each other, as described in this Stackoverflow answer: http://stackoverflow.com/a/20724107/112705

License

Notifications You must be signed in to change notification settings

dxinl/android-orm-benchmark

 
 

Repository files navigation

android-orm-benchmark

Summary

ORM-Benchmark is an Android application built in Android Studio that benchmarks the following against each other:

The benchmark runs the following tasks:

  • CREATE_TABLE - Creation of database structure
  • WRITE_DATA - Writing 1000 'user' objects and 10000 'message' objects
  • READ_DATA - Read all 10000 'message' objects in the table
  • READ_INDEXED - Read an indexed field (the 5000th 'message' in the table)
  • READ_SEARCH - Query the first 100 rows that matches a search term (using LIKE)
  • DROP_TABLE - Drop database strucuture

Each task is run 50 times, and the application reports the average time for each in milliseconds.

Results

Building and running the ORM-Benchmark project produces output similar to that below.

  • The times are in milliseconds.
  • The results are shown on the device and are also logged to Logcat.  

The results below combine the in-memory database results with the on disk database results side by side. They are from a HUAWEI Mate 10 Android 8.0.

  • CREATE_TABLE create_table

  • WRITE_DATA write

  • READ_DATA read

  • READ_INDEXED read_indexed

  • READ_SEARCH search

  • DROP_TABLE drop_table

The query results of GreenDao may be slower than your testing. It is the normal phenomenon becuase I had cleared all objects cache in the end of every test case. If the objects cache did not be cleared, the speed can be about 2 to 3 times faster than the results showing in the charts. However, this improvement will be lower as the size of data being larger becuase of the memory limitation.

Screenshots

main

After pressing "Run Benchmark" you can press "Show Results" to see the results:

results

Technical Reference

Customizing Benchmark Tests

Changing The GreenDao v2 Tests

GreenDao v2 requires a separate project to generate the source code for database entities and DAOs. The ORM-Benchmark-GreenDAO-Generator project is a Java application that you can run to regenerate the database definitions. You only need to do this if you want to change the GreenDao database model!

About

Android application for benchmarking ORMLite and GreenDao against each other, as described in this Stackoverflow answer: http://stackoverflow.com/a/20724107/112705

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%