Today, we released a new version of greenDAO addressing some issues with @Entity annotations. If haven’t tried them yet, please give them a try. We think this is the most convenient way to work with greenDAO, or SQLite in general. For details on the 3.1.1 improvements, please check the changelog.
Today, core Java APIs lack high quality hash functions, and 3rd party implementations provide sub-optimal performance. As non-cryptographic hash function are important building blocks of software, this is a major bummer for developers.
Generally, the selection of available hash functions is plenty, and in the last decade, many new hash functions emerged with very good hashing properties. Surprisingly, the core Java API just still offers Adler32 and CRC32, which were designed as checksums many years ago. Of course, there are many hash implementations available outside of the core Java API. However, Continue reading
4 weeks ago we released greenDAO 3.0 introducing @Entity annotations as an alternative to the generator project. We noticed some issues with this rather big update, and fixed most of those in greenDAO 3.1 (thanks to everyone who reported bugs!). The update also brings two new features:
With greenDAO 3 released, it’s time again to look at the Android ORM performance landscape and do some benchmarks. This time, we also tested newer ORMs for SQLite like DbFlow, requery, SQLDelight, and SquiDB. Also, we had an extensive look at benchmarks done by others. Let’s get started with our results:
At Droidcon Berlin, we noticed a lot of questions around databases and that many people weren’t aware of SQLite alternatives and Object-Relational Mappers (ORMs). Therefore, we follow up with an overview of the mobile database landscape.
What is a mobile database?
While Wikipedia defines a mobile database as “either a stationary database that can be connected to by a mobile computing device […] over a mobile network, or a database which is actually stored by the mobile device,” we solely refer to databases that run on the mobile device itself.
Why use a mobile database?
There are some advantages associated with using a mobile database:
I don’t believe in any statistics I didn’t fake myself (German saying)
Doing good performance benchmarks is hard and benchmarking on Android is no exception. Here is a checklist on how to do fair and robust benchmarks:
We are happy to announce greenDAO Version 3 today. Since its initial release 5 years ago, greenDAO has always been the fastest ORM for Android. It was also the first ORM to apply code generation for maximum performance. With greenDAO 3, we made code generation much more convenient: by adopting entity annotations you can drop the generator project. In its place comes the all new Gradle plugin, which automatically triggers code generation at build time. Like that, you can simply use greenDAO 3 annotations on your entities:
That's really good news. Just by using the new version 3.5.0 of SQLCipher, you can reduce your APK size (and build/deployment time). Not just the binary .so files got smaller, also the big "icudt46l.dat" file was removed in 3.5.0.
To see the effect in an app, we took the greenDAO example app and compared the resulting sizes. Of course, the version using built-in SQLite is by far the smallest, but your APK may lose 4.4 MB if you were using a previous version of SQLCipher:
We noticed one incompatibility with SQLCipher 3.5.x however. Android's SQLiteDatabase defines two additional collations:
In addition to SQLite's default BINARY collator, Android supplies two more, LOCALIZED, which changes with the system's current locale, and UNICODE, which is the Unicode Collation Algorithm and not tailored to the current locale.
Running SQL ORDER commands with "COLLATE LOCALIZED" does not work anymore starting with SQLCipher 3.5.0. That is the downside of the ICU (and ASOP code) removal.
So, what about greenDAO support for SQLCipher 3.5.x? greenDAO used "COLLATE LOCALIZED" in the QueryBuilder when specifying orders using string properties. To ensure compatibility with SQLCipher 3.5, we just released greendao-encryption V2.2.2 without the LOCALIZED collation.
We just released greenDAO 3 beta: it makes the generator project optional and moves to Java annotations. Before the final release however, we want to get your feedback. In particular, we experimented with alternative annotation processing that gives greenDAO more power while it avoids byte code manipulation.Our goal with greenDAO3 is to put the developer in control over entity classes while augmenting the entity code with a little bit of generated code.
At yesterday’s Droidcon Berlin barcamp, we compared different database approaches (SQLite, ORMs, NoSQL). In our interactive session we asked about 80 developers how they use databases on Android and what advantages and disadvantages they see in each approach. Here are the gathered results:
~40% of the participants have used SQLite without additional tools.