re: Core Data performance advice... creating relationships.
re: Core Data performance advice... creating relationships.
- Subject: re: Core Data performance advice... creating relationships.
- From: Martin Linklater <email@hidden>
- Date: Thu, 17 Jan 2008 09:20:48 -0800
On Tuesday, January 15, 2008, at 10:51PM, "Ben Trumbull" <email@hidden> wrote:
>You can address the problem by prefetching Foo's to-many
>relationships during your initial fetch. If Bar has other to-many
>relationships, you'll want to prefetch those in the fetch request for
>"bar where ID = X"
>
>The Instruments set you used doesn't include all the Core Data
>instruments from the main template, specifically "Core Data Cache
>Misses", so Instruments isn't high lighting the specific problem as
>well as it could.
>
>If you add that instrument, you should see both the entity and
>relationships that are being faulted.
Hi Ben - I have done what you suggested. My original code was indeed firing faults for every iteration through my loop - as shown when I ran my application through Instruments with the CoreData template.
I have now changed my code to use [NSFetchRequest setRelationshipKeyPathsForPrefetching] as detailed in the Core Data Performance documentation, and my code is no longer firing faults during the main loop. Excellent.
But the poblem I'm seeing is that enabling the prefetching has actually slowed my application down by around 10%. I have run a few tests with different subsets of my data, and they all show this performance effect. I can only surmise that the increased time needed for the initial fetch is slower than the overhead for all the smalled fault triggers.
Does this surprise you at all ? I may have simply hit the limit of CoreData performance for inserting relationships into a dataset ? Since the data I am inserting relationships into has only just been created, does this mean that the entire dataset is already in RAM, so the fault overheads were minimal to beging with ?
Thanks.
_______________________________________________
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