I experienced a huge performance difference between android 2.3.4 and 4.0.3 on HTC Sensation.
Some additional information:
Time logs:
ICS (4.0.3)
10-16 09:17:06.206: 1 getting dao
10-16 09:17:06.206: 2 got dao
10-16 09:17:06.206: 2 start call batch task
10-16 09:17:06.216: 3 start initializing batch_task
10-16 09:17:06.326: 121 finished initializing batchtask
10-16 09:17:06.836: 623 end batch task
2.3.4
10-16 09:20:00.355: 0 getting dao
10-16 09:20:00.355: 1 got dao
10-16 09:20:00.355: 1 start call batch task
10-16 09:20:00.355: 1 start initializing batch_task
10-16 09:20:00.435: 87 finished initializing batchtask
10-16 09:20:00.445: 96 end batch task
As you can see on ICS takes creating much more time.
What should I do to get the similar performance on ICS?
So after some back and forth in the comments, it turns out that the performance differences in Android ICS may be due to the fact that by default, in that version, SQLite may be running in "TRUNCATE" journal mode. From the Sqlite docs:
The TRUNCATE journaling mode commits transactions by truncating the rollback journal to zero-length instead of deleting it. On many systems, truncating a file is much faster than deleting the file since the containing directory does not need to be changed.
2.3.4 in comparison runs it in Write-Ahead-Logging (WAL) mode. I guess WAL is faster.
To change the journal in ORMLite, you'd do (I guess) something like the following:
someDao.rawExecute("PRAGMA journal_mode = WAL;");
See the Sqlite PRAGMA docs for more examples.