With today’s advent of the Android 4.0.3 image for the Nexus S, we did some performance measurements. We wanted to test how Android 4.0 influences the speed of SQL/ORM operations in comparison to the previous version 2.3 on the same hardware. The results were surprising:
The chart shows that while loading entities got around 40% faster, inserting and updating data runs at half speed only compared to the older version! We expected overall better results because of the more optimized Dalvik VM (despite SQLite is a native library, the Java API imposes an significant overhead). However, the update and insert results hint at major changes in SQLite itself or the file system. We’ll keep you updated, as soon we find out more.
Update: If you want to check the benchmarking code, you should clone the greenDAO repository. The significant class for the benchmark is PerformanceTest. Here you have to comment some lines in again to activate the performance tests. Those are: runTests(1000); (6x) and runBatchTests(list);. It’s an abstract class, so you have to run X as an Android JUnit TestCase to start the benchmark. You will see the performance measurements in LogCat.