All Projects → AlexeyZatsepin → Android Orm Benchmark

AlexeyZatsepin / Android Orm Benchmark

Performance comparison of Android ORM Frameworks

Projects that are alternatives of or similar to Android Orm Benchmark

Sled
the champagne of beta embedded databases
Stars: ✭ 5,423 (+1605.35%)
Mutual labels:  orm, persistence
Query Validator
Compile time validation for HQL and JPQL queries in Java code
Stars: ✭ 70 (-77.99%)
Mutual labels:  orm, persistence
Kotlin Realm Extensions
Kotlin extensions to simplify Realm API.
Stars: ✭ 523 (+64.47%)
Mutual labels:  orm, realm
Base Mvvm
App built to showcase basic Android View components like ViewPager, RecyclerView(homogeneous and heterogeneous items), NavigationDrawer, Animated Vector Drawables, Collapsing Toolbar Layout etc. housed in a MVVM architecture
Stars: ✭ 18 (-94.34%)
Mutual labels:  persistence, room
Qxorm
QxOrm library - C++ Qt ORM (Object Relational Mapping) and ODM (Object Document Mapper) library - Official repository
Stars: ✭ 176 (-44.65%)
Mutual labels:  orm, persistence
Nano Sql
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
Stars: ✭ 717 (+125.47%)
Mutual labels:  orm, persistence
Hibernate Basics
Samples for "Hibernate, how the magic is really done?" talk
Stars: ✭ 44 (-86.16%)
Mutual labels:  orm, persistence
Hibernate Performance
Samples for "Hibernate performance tuning" talk
Stars: ✭ 87 (-72.64%)
Mutual labels:  orm, persistence
Roomasset
A helper library to help using Room with existing pre-populated database [DEPRECATED].
Stars: ✭ 138 (-56.6%)
Mutual labels:  orm, room
Kripton
A Java/Kotlin library for Android platform, to manage bean's persistence in SQLite, SharedPreferences, JSON, XML, Properties, Yaml, CBOR.
Stars: ✭ 110 (-65.41%)
Mutual labels:  orm, persistence
Android-ORM-Benchmarks
No description or website provided.
Stars: ✭ 25 (-92.14%)
Mutual labels:  room, realm
Data
ATK Data - Data Access Framework for high-latency databases (Cloud SQL/NoSQL).
Stars: ✭ 243 (-23.58%)
Mutual labels:  orm, persistence
android-room-example
Android Kotlin app showcasing the Room persistence library
Stars: ✭ 45 (-85.85%)
Mutual labels:  room, persistence
Tx Word2vec Small
腾讯word2vec模型缩小版
Stars: ✭ 313 (-1.57%)
Mutual labels:  jupyter-notebook
Machine Learning Python
機器學習: Python
Stars: ✭ 316 (-0.63%)
Mutual labels:  jupyter-notebook
Jetpack github
基于Kotlin + Jetpack全家桶 + Coroutines(协程) + Flutter等架构实现的一款精简版Github客户端项目,望与广大小伙伴一起成长,欢迎start or fork!
Stars: ✭ 314 (-1.26%)
Mutual labels:  room
Shapematchinggan
[ICCV 2019, Oral] Controllable Artistic Text Style Transfer via Shape-Matching GAN
Stars: ✭ 315 (-0.94%)
Mutual labels:  jupyter-notebook
Advanced Deep Trading
Mostly experiments based on "Advances in financial machine learning" book
Stars: ✭ 316 (-0.63%)
Mutual labels:  jupyter-notebook
Notebooks
Directory of Jupyter notebooks exploring various topics
Stars: ✭ 315 (-0.94%)
Mutual labels:  jupyter-notebook
Tensorflow Image Classification
CNN for multi-class image recognition in tensorflow
Stars: ✭ 312 (-1.89%)
Mutual labels:  jupyter-notebook

Performance comparison of Android ORM Frameworks

At the moment there are a lot of ORM-libraries for the Android OS. We reviewed the most popular ones and compared them by performance and some other parameters. As libraries for comparison, the most popular solutions at the time of writing were chosen: ORMLite, Sugar ORM, Freezer, DBFlow, requery, GreenDAO, ActiveAndroid, Room, Sprinkles. Also in the comparison participated "clean" SQLite - the built-in API for working with SQLite in Android, without the use of ORM, and the popular NoSql solution - Realm.

We considered 3 variants(simple, complex, balanced), and for each of them 4 operations(CRUD).

Models

public class Library{ 
    String address;
    String name;
}

public class Book{
    String author;
    String title;
    int pagesCount;
    int bookId; 
    Library library;
}
public class Person{
    String firstName;
    String secondName;
    Date birthdayDate;
    String gender;
    long phone;
    Library library;
}

Test cases

  • Simple - 1 Library object per 1000 Book objects
  • Complex - 1 Library object for 500 Book objects and 400 Person objects (5 Libraries, 2500 Books, 2000 Persons)
  • Balanced - 1 Library object for 50 Book objects and 50 Person objects (50 Libraries, 2500 Books, 2500 Persons)

For each test cache/lazy initialization were turned off, and we perform an average of 10 measurements per operation.

Results Table

Library write(s) read(s) update(s) delete(s) write(c) read(c) update(c) delete(c) write(b) read(b) update(b) delete(b)
ORMLite 151 666 122 105 445 3836 857 811 1563 3426 724 728
SugarORM 245 842 252 152 1402 4129 1467 1003 2204 4397 1702 1197
Freezer 248 5430 240 4797 1337 78982 2221 22104 3255 134942 1887 29515
DBFlow 97 757 459 186 360 3534 3124 1044 1129 4653 5204 1268
Requery 87 1501 147 129 461 8057 861 802 1368 8002 886 763
Realm 151 29 1079 723 698 688 19666 9180 1522 210 21129 10006
GreenDAO 81 1238 117 97 357 5552 455 274 598 5905 504 315
ActiveAndroid 3123 930 2293 2423 14671 4165 15958 13023 17213 4653 19303 14642
Sprinkles 5766 1050 6364 605 25978 4334 65579 2428 27774 4526 37705 2519
Room 131 699 170 109 562 3201 717 403 1330 3532 790 507
SQLite 50 436 63 80 386 2155 192 284 1146 2313 213 318

Histograms

Overal

More detailed (Simple)

More detailed (Complex)

More detailed (Balanced)

Summary

ORMLite

It does not save much from the boilerplate code, however one of the fastest libraries out there is built-in caching and delayed initialization, good documentation. Despite all the advantages, I would not use it, because The main reason for using ORM is getting rid of writing repetitive code, and, therefore, speeding up development, which in other libraries is realized, in my opinion, better.

SugarORM

Of the advantages can be noted ease of use, which is not enough in ORMLite, and that's it. Has a separate drawback associated with the approach to implementation - it is not "friendly" with Instant Run, so when working with it you have to disable it.

Freezer

A relatively young library is not widely distributed. Comfortable, but do not make any complicated manipulations with it. In addition, the speed of work, to put it mildly, leaves much to be desired.

DBFlow

One of the best in the parameters outlined in this article. One of the fastest write / read operations is the average update / delete speed. According to the parameters presented in Table 2, it is the best on a par with Realm. In my opinion, is one of the best alternatives.

Requery

Quite a controversial decision, in the fall because of problems with installation and documentation (if used without RXJava). If you understand, working with it becomes convenient. Supports different databases, rich functionality.

Realm

A relatively fast and convenient library, all links are simply implemented, which is related to the object orientation of the database, even reading "clean" SQLite even when manually cached for it by reading. Excellent documentation. Is, perhaps, one of the best option for storing data on a mobile device at the moment, the minus can only be an increase in the size of the apk-file by 2.5 MB. For all ORMs, except for Realm, built-in object caching was disabled, hence the readings.

GreenDao

It is flexible and convenient to use one-to-many communication, but very unpleasant code generation, as a result of which your classes will be filled with a bunch of methods and comments. In addition, you need to connect the Gradle plug-in, which greatly increases the build time. Also, developers presented their database - ObjectBox - object database, which they position as the fastest, comparable to GreenDao, ORM.

ActiveAndroid

Not very fast, but quite convenient and proven over time solution. Quite popular, but because you can find many articles, solutions to issues and other things, which reduces the appearance of "unresolvable" problems to a minimum.

Sprinkles

Each entry is accompanied by an unnecessary sample (SELECT * FROM% s WHERE% s LIMIT 1). From sql-requests too does not rescue. Performance indicators are the worst of the submitted. Therefore, there is no reason to use it for your projects.

Room

An interesting solution presented on Google I / O 2017 as optimal for working with the database on Android OS. Despite the fact that it is necessary to use explicit sql-requests, the library turned out to be quite convenient and I liked it personally. On performance is in the lead, so I would advise you to choose this particular library. Since this solution, submitted by Google, it will quickly become popular, and, therefore, there will be no problems with finding solutions to problems that occur along with it.

SQLite

A lot of code, longer in time, but speed and flexibility are still unmatched.

Сonclusion

Summing up, the most "fast" ORMs were Realm, GreenDAO, ORMLite and Room, but if performance is critical for the project, a "clean" SQLite with a custom cache is still the best choice. On the other parameters, the best are Realm, DBFlow and GreenDAO. Thus, for small projects and projects of medium complexity, I recommend using DBFlow or GreenDAO, if the size of apk is not important - Realm. Realm and Room are suitable for large projects. And only if their capabilities for some reason are not enough, or the ORM-approach is not for you, to return to using the built-in API for SQLite.

In addition to those discussed in the article, initially ORMs such as AndrORM, OHibernate, MemoryORM, ORMDroid, StromIO were also involved in the review, which were dropped for one reason or another.

All measurements were made on the Samsung S7 device.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].