Re: CoreData performance issues
Re: CoreData performance issues
- Subject: Re: CoreData performance issues
- From: Tomek Piatek <email@hidden>
- Date: Thu, 23 Jun 2005 09:10:57 +1200
On Jun 23, 2005, at 8:04 AM, John Timmer wrote: On 22/06/2005, at 5:29 PM, Chris Hanson wrote: On Jun 21, 2005, at 5:10 PM, Tomek Piatek wrote: We have written a simple test application which reads in a line at a time from the text file and for each record creates a managed object instance. The managed object context is saved only once after all records have been processed. We want to avoid duplicates and in fact we want to reuse existing managed objects. For example, when ingesting a new scene we want to create a new project object only if one with the given name doesn't already exist.
Just out of curiosity, are you matching against a single identifier every time when you check whether an object exists already? If so, you should just dump new keys into an NSMutableSet, since checking whether an object is in a set is very efficient. If you use the CFSet function to check for the presence of your key in a set instead of the ObjC method, you can also cut down on object messaging and speed things up even more.
Nice solution but it won't work for us because when we determine that an object already exists we need to get a reference to it so that we can set it in the relationship for the object we have just created. Hmmm, that sounds confusing. Example:
Project<---->>Scene
Every time we create a new Scene that scene belongs to some project. Rather than creating a new project we need to find out if a project with a given name has already been created. If it has then we want to get a reference to the managed object representing that project and set it in the "project" relationship of the Scene object.
-t
|
_______________________________________________
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