Reputation: 373
I am creating an iOS app that consists of a map. The data are stored using Core Data. When the app launches, which is the fastest way to fetch these data? NSFetchRequest or NSAsynchronousFetchRequest?
Upvotes: 2
Views: 990
Reputation: 898
NSFetchRequest
vs. NSAsynchronousFetchRequest
is more about synchronous vs asynchronous, not really about speed. So if you're fetching in the UI context, it's about blocking the UI vs not while you wait for results to come back.
Depending on the # of records you're querying, there are other factors that could affect speed more significantly:
fetchBatchSize
fetchLimit
/fetchOffset
Upvotes: 1
Reputation: 5643
If UI fetch makes some delay or performance problem then you should use NSAsynchronousFetchRequest
. I think you will probably fetch some annotations so you need to use NSAsynchronousFetchRequest
There is a nice answer here related to your question : https://stackoverflow.com/a/52973257/14531220
Upvotes: 1