Post

Replies

Boosts

Views

Activity

Reply to Core Data slow to save
Thank you for that suggestion. I am following advice I found in an online series about the best way to set up a Core Data stack. It recommended using a private managed object context to perform background saves to the persistent store, and having a child context linked to the main queue to handle operations relating to the UI. This advice was justified on the basis that saves to the persistent store could take a while, and shouldn't block the main queue. However, in my situation it seems that the main queue save is taking considerably longer than the private queue one. I should also say that in my real project, I am also creating child contexts of the main context from time to time which run on background queues to avoid blocking the main queue, so I don’t think I can do everything on a single context linked directly to the persistent store coordinator. Is there anything I can do to speed up the processing itself, other than avoiding using a relationship in the data model?
Jan ’25