I’m working on an app connected to a web service which retrieves lot of data during app launch. I use concurrency to avoid UI blocking. I choosed the following Core Data Stack pattern : background private moc —> main moc —> writer private moc —> coordinator —> file.
The problem occures when operations are being imported. The CPU is 100% used and the app gets slow along the process. I work with batches of 300 objects for a total import of about 10,000 objects.
For each batch, an NSOperation is created with an associated temporary moc, child of the background one. Operation is enqueue in an NSOperationQueue. When the importing jobs are done, the app get even slower, depending on the number of jobs running. I also note that when the app is killed, and relaunched, it’s really way more usable and fast.
My memory footprint changes between 40Mo and 60Mo when importing. Do you think it’s too much?
Do you think my stack pattern is appropriate for my needs? Should I migrate to a stack with 2 coordinators?
Moreover, when fetching data to display in tableView, should I use performBlockAndWait to get data immediately before displaying the view ?
Thanks for your help