Reputation: 4968
i have an app in which i am using a sqlite db of PRAGMA user_version 5
.
In this i have three tables in which i am adding some data and deleting some data by a period of interval days. The adding data and deleting data from sqlite db takes place right after the splash screen.
Now the problem is when i tested the same build in three different android devices of various versions as follows.
1. Motorola(2.1) - more than a year old
2. SamsungAce(2.3) - buyed 8 mnths before
3. Xperia(2.3) - new device.
In this three device, when the app gets loaded, in 2.1 alone it takes a very long time(more than a hour) to add or deleted data from the sqlite db. In other two devices it takes just a 2 to 5 min of time to get loaded.
Why does the app gets slowed in 2.1 version. Is this because of the version or as the device has become very old
Pls clarify me this doubt...
Upvotes: 0
Views: 234
Reputation: 2253
There should and will be different speed results between 2.1 and 2.2/2.3 because they use a different version of sqlite3 - 2.1 uses slite 3.5.9 and 2.2 & 2.3 uses 3.6.22 .. and it does change the speed (higher versions not always faster.. it depends on the query and open for controversy) although I could not find a speed test comparison between the two versions.
But..
2000 inserts is nothing.. if its plainly insert with known data read from another (opened/streaming) source it should not take more then a couple of seconds.. you can try to remove your code for the sake of testing and try to just FOR LOOP 2000 inserts and test the timing.
and if you can show us your code maybe there's something else your not paying significant to like the source you are getting the data from..
Upvotes: 1
Reputation: 2357
One thing that I can suggest is to use transactions. By the looks of it you are executing multiple queries on the database and SQLite will perform much better if those queries were in a transaction.
Take into account the comment from Siva K even 2-5 minutes seems long unless you are adding or removing huge amounts of data.
If transactions don't help post your code as even 2-5 minutes seems long. If a user has to wait 2-5 minutes at every data add/delete/update the app. is not going to deliver a good experience.
Upvotes: 2