![]() ![]() If (_connection.State = ConnectionState.Closed)Īs you're using a single connection across different threads sooner or later, set Serialized as the threading mode before any connection is opened in the FinishedLaunching()-method of your AppDelegate: SqliteConnection.SetConfig(SQLiteConfig.Serialized) Set PRAGMA Options Public static SqliteConnection GetConnection() Private static SqliteConnection _connection Using a single connection solves that problem, and it's not expensive in any way as your app is the only client, that is accessing the database. That means that every connection is trying to get exclusive access to that file (depending on the level of protection against data-loss you have configured via pragma-options). Use a single connection for your whole application Today I am not talking about 200-600 milliseconds for that kind of selects mentioned above, but about 10-20 milliseconds. At the end some things in combination did the trick. I tried literally everything I found online, not everything had an effect. What sounds fast at the first glance is a real show-stopper when you're swiping through a set of pictures and every swipe delays about half a second or more, which always feels like 1-2 seconds to a user. A huge problem.įetching my data with ADO.NET () was very time consuming, which means that simple selects of a few dozen records could last 200-600 milliseconds. I didn't think that much about performance - iPhones are no super computers, that's for sure, but a few hundred records should not be a problem.Īs it turned out, it was a problem. As my application works completely offline only synchronizing with a server every minute, there are a lot more of reads than writes. ![]() I had only a dozen tables and a few hundred records to store. Wherever you look, everyone seems to recommend that little but powerful database system. For storing data locally within an iOS app there is almost no alternative to SQLite.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |