tezvyn:

Faulting in Core Data

Source: interviewintermediate

WHAT IT TESTS: lazy loading in Core Data. OUTLINE: a fault is a placeholder object whose property data is not yet loaded; accessing a property fires the fault and fetches from the store, saving memory. RED FLAG: ignoring the N+1 fetch storm faulting can cause.

WHAT IT TESTS: understanding Core Data's lazy materialization and its performance trap. ANSWER OUTLINE: faulting means Core Data returns lightweight placeholder objects whose attribute and relationship data are not loaded until first accessed, conserving memory and speeding initial fetches. The pitfall is that iterating many faults and touching their properties fires one fetch per object, an N+1 storm; mitigate with batch fetching, relationship prefetching, or returnsObjectsAsFaults set to false.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Faulting in Core Data · Tezvyn