views:

29

answers:

1

Does using an NSFetchedResultsController provide any performance advantages on the iPhone over an NSArray?

I have between 4,000 and 8,000 records stored in core data and wanted to know if I should select one over the other. Is the NSFetchedResultsController just used to make code 'prettier'?

My concern is searching, and lag on keyboard button presses (as well as the issue of loading that many records into memory). Thanks!

+1  A: 

Given your parameters, Core Data will be faster than an array especially if you make any changes to the data.

The disadvantage of an array in this case is that you have to load the entire array into memory in one go.

It might seem obvious that Core Data will be slower than more primitive methods but owing to fine tuned optimization plus the ease of integration with the rest of the API it is actually fairly hard to beat Core Data in real world apps with significant amounts of data.

TechZen
Sorry, just to clarify: I am using Core Data Managed Objects in the Array also. So does an NSFetchedResultsController not load the data into memory automatically? Thanks.
Kevin Sylvestre
The NSFetchedResults controller will load objects into memory as required by your table view, you can tune how many it brings in off disk at a time using setFetchBatchSize: on the NSFetchRequest that you provide to the controller.
ImHuntingWabbits