Core Data is pretty fast

There's an article in the excellent online magazine objc.io by Brent Simmons on the topic of using SQLite instead of Core Data.  An example I've heard cited before is Brent's example that he uses in this article of "what if you need to mark 10,000 items as read?".

This is a compelling example because with SQL, you can update all the records with a single statement, whereas with Core Data you need to actually walk all 10,000 items and retrieve and update them.  But how long does it actually take?

I put together a simple test app that creates 10,000 entities and saves them.  Code here.

On my iPhone 5, the output from this little snippet of code is:

2013-09-13 20:09:35.979 CoreDataPerf[5874:60b] Creating Entities

2013-09-13 20:09:36.932 CoreDataPerf[5874:60b] Created and saved 10,000 entities

2013-09-13 20:09:37.822 CoreDataPerf[5874:60b] Updated 10,000 entities

 

890 milliseconds. 
 
Not great, not terrible.  Better than I expected, actually, but I could see this being a problem in an app that frequently needed to operate across all the items. 
Â