• 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: Wed, 19 Aug 2009 11:10:11 -0700

Ruotger,

Interestingly enough, I experienced this behavior in my latest app which doesn't use Core Data. It uses SQLite directly instead. I recalled I had experienced this a long time ago (years ago) and someone (I don't remember who and where) mentioned a solution/ workaround/hack, which involves reading the file. Let's call this function warmUpFile():

        FILE *my_stream = NULL;
        const char *my_filename = ...;
        size_t object_size = 1024;
        size_t object_count = 1024;
        char buf[object_size * object_count];

        my_stream = fopen (my_filename, "r");
        while (fread (&buf, object_size, object_count, my_stream) > 0);
        fclose (my_stream);

I have timed it both modes, always after rebooting my computer:

Reboot > Launch app > sqlite3_open_v2 > do stuff == 35 seconds
Reboot > Launch app > warmUpFile() > sqlite3_open_v2 > do stuff == 7 seconds


Once warmUpFile() has been executed, let Core Data open the store and see if it helps.

-- Tito

On Aug 19, 2009, at 10:45 AM, Ruotger Skupin wrote:


Am 19.08.2009 um 19:18 schrieb I. Savant:


Hmm ... time to hit the books if you haven't already:

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html#//apple_ref/doc/uid/TP40003468

Have you tried anything suggested there?


Fetch Limits: Not tried
The App basically loads objects and displays them in a table, so I can't fetch only half of them as sorting depends on the contents of the objects. I do fetches with sort descriptors though, to keep sorting time down (always below 0.1 sec).


Batch faulting: tried
It helps but it is still too slow.

Pre-fetching: not tried
But if I understand the document right it's just a special case of Batch Faulting and I don't see any faults fired since I use Batch Faulting anyway


Reducing Memory Overhead: most don't apply (Garbage Collection / no temporary managed objects)
I set the undo manager to nil


Large Data Objects (BLOBs): not used
I'd say all object are under 1k

Would switching to a different store type (other than SQL) help? The database is not that large (in my example 55MB) maybe an atomic store has its advantages there?

Ruotger

_______________________________________________

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


  • Follow-Ups:
    • Re: Core Data dog-slow when using first time after boot
      • From: M Pulis <email@hidden>
References: 
 >Core Data dog-slow when using first time after boot (From: Ruotger Skupin <email@hidden>)
 >Re: Core Data dog-slow when using first time after boot (From: Nick Zitzmann <email@hidden>)
 >Re: Core Data dog-slow when using first time after boot (From: Ruotger Skupin <email@hidden>)
 >Re: Core Data dog-slow when using first time after boot (From: "I. Savant" <email@hidden>)
 >Re: Core Data dog-slow when using first time after boot (From: Ruotger Skupin <email@hidden>)

  • Prev by Date: Re: Coding with VM limitation on the iPhone?
  • Next by Date: Vvidget article on MacResearch
  • Previous by thread: Re: Core Data dog-slow when using first time after boot
  • Next by thread: Re: Core Data dog-slow when using first time after boot
  • Index(es):
    • Date
    • Thread