• 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: Efficient Updating of Thousands of NSManagedObject Relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficient Updating of Thousands of NSManagedObject Relationships


  • Subject: Re: Efficient Updating of Thousands of NSManagedObject Relationships
  • From: Kenny Carruthers <email@hidden>
  • Date: Mon, 28 Jul 2008 16:51:31 -0700

Even building up an array of managedobjects and then passing that to the set returned from mutableSetValueForKey results in extremely long updates. For example, I just tried moving 1300 songs to a playlist and while it took almost no time to fetch each song from the managed context and build up the array, the following call took over a minute to execute:

[[destinationList mutableSetValueForKey:@"songs"] addObjectsFromArray:songs];

When it completed the data was correct, but I have to imagine there's a much faster way to do this.

As always, thanks for any help.

Sincerely,
Kenny

On Jul 28, 2008, at 1:35 PM, I. Savant wrote:

for (song in songs)
NSManagedObject *song = ... (Fetch some from proper context)
song.playlist = destinationList
end

You could always ask the playlist for its -mutableSetValueForKey:@"songs" ... then call -addObjects: and pass in your songs array.

--
I.S.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Efficient Updating of Thousands of NSManagedObject Relationships (From: Kenny Carruthers <email@hidden>)
 >Re: Efficient Updating of Thousands of NSManagedObject Relationships (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Setting conditional breakpoint on Cocoa method?
  • Next by Date: What is the maximum NSURL length?
  • Previous by thread: Re: Efficient Updating of Thousands of NSManagedObject Relationships
  • Next by thread: Predicate Binding Format/case sensitive question ...
  • Index(es):
    • Date
    • Thread