Re: CoreData performance issues
Re: CoreData performance issues
- Subject: Re: CoreData performance issues
- From: Chris Hanson <email@hidden>
- Date: Tue, 21 Jun 2005 22:58:54 -0700
On Jun 21, 2005, at 10:36 PM, Tomek Piatek wrote: This isn't the most efficient way to do this kind of batch import. Most importantly, don't issue fetch requests for step 3. Instead, just keep track of the objects you create during the import by name in a dictionary. If you can run subsequent imports, then do a fetch once at the very beginning to "prime" your dictionary, and use that to determine uniqueness for the rest of the import.
This makes sense and someone on the list has already suggested this approach. The problem I see is with the size of this lookup structure. We create hundreds of thousands of objects. They will all end up in the managed context which stores them in memory.
Every time you execute the fetch request, the context needs to go through all the objects it knows about and determine if any of them match the entity and predicate of the fetch. This means it has to go through every object you just inserted.
I don't think you'll notice a substantial overhead to using NSDictionary instead of fetch requests to unique your objects during your import process. Give it a try and see.
I'm not sure at what point the context flushes managed objects back into persistent store. I know it does it when you send it a "save" message.
The context doesn't "flush" managed objects "back" to into persistent store. It will only save when you tell it to do so.
-- Chris
|
_______________________________________________
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