Coredata, unfaulting and NSArrayController
Coredata, unfaulting and NSArrayController
- Subject: Coredata, unfaulting and NSArrayController
- From: Guillaume Rager <email@hidden>
- Date: Thu, 27 Oct 2005 12:04:02 +0200
Hi list,
I've got a coredata model with two basic entities Note and Priority,
I just want to display data using a NSArrayController.
First method is to bind NSArrayController to Entity and use the
managedObjectContext as content source.
Using this method is extremely fast to display data in a table view.
A small check shows us that objects are NOT fault (isFault returns
NO), so that means everything is loaded in memory.
Second method is to fetch all data using an NSFetchRequest instance,
returned objects are fault (isFault return YES), batch faulting
technique does not work (something wrong with documentation(*)) and
if we need to display these objects in tableview datasource method,
this is extremelly slow because each object has to be unfaulted.
So the question is, how can NSArrayController load and UNFAULT many
objects (10000 and more...) so quickly ???
If coredata engineers could provide me some design concepts, it would
be great!
Thank you in advance.
(*) : the documentation from apple
Batch Faulting
Sometimes a number of objects may be represented by faults. If each
fault is fired individually, then Core Data performs a separate round
trip to the persistent store for each. This incurs a comparatively
high overhead. Instead, you can "batch fault" a collection of objects
by executing a fetch request using a predicate with an IN operator,
as illustrated in the following example.
NSArray *array = [NSArray arrayWithObjects:fault1, fault2, ..., nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self IN %
@", array];
(In a predicate, self represents the object being evaluated—see
Predicate Format String Syntax.
Guillaume
-----------
GUMITECH - France
http://www.gumitech.com
"Chaud cocoa, chaud chocolat !"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden