Frage

I have a core data entity, which has a relationship to another entity.

Entity A has an NSSet which contains objects of Entity B. Entity A is stored as a property called user in a singleton available to every other class

Now, I want to display the latest 6 objects of Entity B, which has a property of type NSDate that is the gained date.

Which is the more efficient way of doing things:

  1. Sorting the NSSet into an NSArray
  2. Running a fetch request to get the latest 6 objects
War es hilfreich?

Lösung

Test it. It depends entirely on whether that relationship contents is already faulted into memory and how many items there are.

Already faulted AND small number of items should tend towards the set. not faulted OR large number of items towards Core Data (I.e. Fetch request with predicate).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top