• 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: Core Data dog-slow when using first time after boot
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data dog-slow when using first time after boot


  • Subject: Re: Core Data dog-slow when using first time after boot
  • From: Tito Ciuro <email@hidden>
  • Date: Fri, 22 Jul 2011 11:58:54 -0300

Hello all,

I saw an interesting reply from Dr. Hipp posted today:

http://www.mail-archive.com/email@hidden/msg62618.html

This seems to explain why SQLite (and Core Data) might sometimes launch and execute very slowly.

-- Tito

On Sep 3, 2009, at 5:00 PM, Ben Trumbull wrote:

>
> On Sep 3, 2009, at 4:49 AM, Ruotger Skupin wrote:
>
>>>>> Since it's not a many to many, you can perform the prefetching effectively by hand using a fetch request to preload the relevant destination rows with an IN query based on the data you initially fetched for the source entity.  You shouldn't have to, but if you've run into a bug, that's how you could workaround it.
>>>>>
>>>>> You still haven't described the NSPredicate you were using with filteredArrayUsingPredicate.  Being more forthcoming about the context and details of your problem will help us get you answers more quickly.
>>>> This is the predicate I was using for the test of the original post, but since I use Smart Folders predicates can look a lot different (i.e.: complex):
>>>>
>>>> (additionalInfo.onTheFlyIsInternal == 0 AND additionalInfo.isSuppressed != 1) AND (account.uniqueID IN {"D1AB3788-00DF-4475-A979-CE3EFC3987B5"} OR FALSEPREDICATE)
>>>>
>>>
>>>
>>> You'll want to prefetch additionalInfo and account.
>>
>> Hm. Problem here is: As mentioned I use the predicate for a smart group. So the predicate can vary wildly and can reference basically any entity in the model. So what is the best strategy here? "Decompile" the predicate (which is built by an NSPredicateEditor) and prefetch the keypaths it takes? Prefetch "everything"?
>
>
> Prefetching everything is usually undesirable.  The easiest approximate solution is to just track the hot button relationships for each of your core entities, and look up which keypaths to prefetch by entity name.  Of course, you can also do a lot less filtering in memory if you pass the predicates to the database with the fetch request.  You only need to prefetch relationships you are going to use in memory.  You don't need to prefetch anything that's simply used as part of the predicate in the fetch request itself.
>
> Walking through the predicate and gathering up the keypaths used is very tedious, but not especially difficult, if you find yourself wanting a complete solution.
>
> - Ben
>
> _______________________________________________
>
> 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

_______________________________________________

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

  • Prev by Date: NSDecimalNumber converted to NSNumber
  • Next by Date: NSDocument: Read-only types and autosavesInPlace
  • Previous by thread: NSDecimalNumber converted to NSNumber
  • Next by thread: NSDocument: Read-only types and autosavesInPlace
  • Index(es):
    • Date
    • Thread