Hi there, In "Core Data Programming Guide" Apple recommend a way to batch fire fault a collection of objects, It should be implemented as below: NSArray * arrayOfFaults = [NSArray arrayWithObjects:object1,object2,nil]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self IN %@", arrayOfFaults]; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Foo"]; [fetchRequest setPredicate:predicate]; [fetchRequest setReturnsObjectsAsFaults:NO]; [managedObjectContext executeFetchRequest:fetchRequest error:NULL];
However using "Core Data" Instrument on iOS 6 simulator, I found this fetch almost as same time as other fetch. In other words, it goes to disk and did not use the cache. It's unreasonable . Since it's an " IN " clause , Core Data could use the objectID to find object in cache. There are no need to go to the disk if all of them could be found in cache. I am pretty sure these objects in arrayOfFaults are in cache. If I replace above code with this one, not cache miss are reported: for (NSManagedObject *object in arrayOfFaults){ [object willAccessValueForKey:nil]; } So my question is : are there any way to batch fault objects while take advantage of the cache ? Bob Cromwell _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com