Access Patterns

Improving performance within Core Data isn’t necessarily only about the repository and order of loading the data. We can do a number of things within the user interface to help performance as well.

Searching the repository can be absolute murder on performance. Whether we’re searching at the request of the user or performing a search in the background, we need to be very careful to avoid impacting the performance of our application.

Order Is Important

Just like any conditional, the order of the logic is important. Simple equality is faster than inclusions such as in, contains, and so on. When building the predicate, try to order the logic from left to right, simple to complex. This process allows Core Data to fail quickly and ...

Get Core Data in Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.