Re: [CD] slow insertion with relationship ... SOLVED
Re: [CD] slow insertion with relationship ... SOLVED
- Subject: Re: [CD] slow insertion with relationship ... SOLVED
- From: Volker Runkel <email@hidden>
- Date: Fri, 22 Sep 2006 11:09:41 +0200
Hi list,
I want to share my success and want to report how I managed to get my
MO import really fast, even with setting my relationship:
The problem: a rather slow import of data from an array into my MOC
when setting a relationship for each of my newly created MOs.
Solution:
1. I packed my MO creation into a thread with its own MOC, sharing
only the PSC with my main MOC
2. I fetched a reference to the "parent" of a one-to-many relationship
3. Enumerating through an NSArray that holds the data for new MOs
3a. Create MO in the threads MOC
3b. setValue to fill it with data
3c. setValue to set the parent of the relationship
4. After creating all new MOs I processPendingChanges and save the
threads MOC
5. When returning to my mainThread I refresh my "parent" object so it
gets the newly added objects displayed in a master-detail NSTableView
setup.
It is now faster than ever before and until now I found no bugs or
new problems.
Thanks,
Volker
_______________________________________________
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