Re: Efficient Updating of Thousands of NSManagedObject Relationships
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