Master Data Performance: NSPredicate Comparing Objects

If my model Author NSManagedObjecthas an attribute authorID(defined by the server), will it work better NSFetchRequestif the filters are NSPredicateon authorIDrather than on the full object Author? Say I bring everything to Book NSManagedObjectsome Author. Which is predicateFormatbetter?

[NSPredicate predicateWithFormat:@"author = %@", anAuthor]

or

[NSPredicate predicateWithFormat:@"author.authorID = %@", anAuthor.authorID]

What is the best way to profile this? I have Core Data testing working with OCUnit( SenTestingKit). Does iOS have something like a Ruby Benchmark Module ?

+5
source share
2 answers

, -com.apple.CoreData.SQLDebug 1, .

, Core Data SQL ( , SQLite).

+1

( Author), , , .

(, Book), Author,

[NSPredicate predicateWithFormat:@"author = %@", anAuthor]

SQLite , Book Author Author. , Author. CoreData .

[NSPredicate predicateWithFormat:@"author.authorID = %@", anAuthor.authorID]

SQLite join Author authorID. . , authorID .

0

All Articles