Writing many real-time values ​​in a database on iPhone with SQLite3

I am currently writing an iOS application and I have many entries that I write to the database. Despite the fact that with the iPhone you write in flash memory, the peer still has faster access times. To improve performance, I write to the temporary cache in ram, and then at some point add this cache to the database.

What is the standard practice / technique with an understanding of how often to write cache to the database? How can I customize this?

Thanks in advance!

+4
source share
1 answer

I had a similar cache issue that needed to be flushed to the server instead of the local database. I used the tools to find the “typical” size of one of the cached objects (I had pretty unified ones), and I just support counting in the cache, and when I cross the threshold I free my cache on the server. Then I found out about NSCache, which has a lot of the same behavior. I explored ways to dynamically size each object in the cache, but found it tedious and fragile.
Basically, I think you need to decide what makes sense from your application based on the usage characteristics collected with the tools. I found a video from the 2011 WWDC conference “Section 318 - iOS in depth performance” to be very useful for such situations. You can find it on itunes U.

+1
source

Source: https://habr.com/ru/post/1396899/


All Articles