Core Data has had a polarizing effect within the development community.You’d be hard pressed to meet a Cocoa developer who is completely ambivalent to the topic. I believe that Apple has made significant improvements to the framework each year.This year was no exception, as two highly specialized APIs were introduced., while somewhat esoteric, were introduced to combat specific issues developers encounter with the framework.
Iterating these steps across thousands of objects leads to long wait times for the user, as well as increased memory and CPU load on the device.
The allows you to go directly to the store and modify your records in a manner similar to traditional databases, rather than with an object graph.
Creating a batch request starts off the same way it does with a standard fetch request.
An entity name must be supplied to indicate the type of objects being fetched. Using Mark Dalrymple’s trusty BNRTime Block, we can see that a batch update on 250,000 objects takes just over one second, while an update that involves iterating over each item takes around 16 seconds for the same number of objects.
(Note: All tests were run using XCode 6 Beta 7, along with the i Phone 5s Simulator on a late-2013 Mac Book Pro.) In additon to speed considerations, memory usage on the batch update side is significantly lower.