Re: Coredata, unfaulting and NSArrayController
Re: Coredata, unfaulting and NSArrayController
- Subject: Re: Coredata, unfaulting and NSArrayController
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 27 Oct 2005 15:39:02 -0700
On Oct 27, 2005, at 3:04 AM, Guillaume Rager wrote:
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 ???
The documentation is correct.
Executing a fetch does retrieve the data for the objects returned,
and the results are cached in memory. Executing a fetch does not,
however, explicitly unfault any existing faults, so that in your
scenario -isFault will still return YES immediately after the fetch.
When the faults are fired, however, the data is retrieved from the
cache, and additional fetches are not required.
Thus the pattern described in the documentation -- performing a
single fetch -- is significantly less expensive than unfaulting each
object individually (which results in a fetch per fault).
[The difference with the array controller is that the controller
itself unfaults the objects (and hits the cache) before you have a
chance to call -isFault.]
mmalc
(With thanks to BT.)
_______________________________________________
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