• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [CD] slow insertion with relationship ... SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >[CD] programmatically inserting MO in MOC gets slower with number of items (From: Volker Runkel <email@hidden>)

  • Prev by Date: Re: Cover flow view in Itunes 7.
  • Next by Date: Accessing objective-c class from a cpp file
  • Previous by thread: Re: [CD] programmatically inserting MO in MOC gets slower with number of items II
  • Next by thread: How much does NSObject's bind:toObject:withKeyPath:options: do?
  • Index(es):
    • Date
    • Thread