• 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] Improve save performance ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Core Data] Improve save performance ?


  • Subject: Re: [Core Data] Improve save performance ?
  • From: Scott Ellsworth <email@hidden>
  • Date: Mon, 16 Jan 2006 15:14:31 -0800


On Jan 16, 2006, at 3:01 PM, Eric Morand wrote:

Thanks to both of you for the explanation. I'll try to learn using Shark...

For now, I have some news : I've created a test Core Data app, with the same managed object model than my official app.
I've then tries to save an object (of the same entity than the one that takes so much time to save on my app) using an SQLite persistent store and an XML one.
Here are the results :


- SQLite : around 0.450 second
- XML : around 0.005 second !!!

Try the same thing with a few hundred and a few thousand objects, of which you only want to read/change a subset. Storing one object is the worst case for a sql store, I suspect, along with hitting every object in the store. Try it with a binary store, and I bet it gets even faster.


Sql stores are very efficient, at least in my experience, when you want to retrieve a subset of the total object list, especially if there are strange conditions (predicates) that determine which ones qualify.

Recent emails from mmalc, et al, to me have convinced me that it is even fast to do a few thousand relationship traversals, as long as a prior fetch fills the cache first. Faults are cheap if they do not hit the database.

A second big win is the memory management. The SQL store only keeps things in RAM that are currently in use. XML and binary stores have to keep everything in RAM. If you only have one object in the store, then this does not save much, but if you have thousands of objects in the store, and only tens visible to the user, then all the others live happily on disk.

In my case an XML persistent store is around 100 times faster than SQLite !!!??? Is this normal ?

I will wait for the CD folks to chime in here.

Maybe there is something I'm doing wrong when creating my SQLite persistent store. I thought a SQLite store was faster than XML store.

It is, but primarily at querying subsets when the data set is larger than you really want in RAM at any one time.


I have found that the sql store takes longer than I am happy with to write out 15k entities. Takes a minute for my app once the data is loaded, and I really want that cut down some. I have been meaning to turn on the sql log, and see whether it is a CD problem, or one of my own.

Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [Core Data] Improve save performance ?
      • From: Eric Morand <email@hidden>
References: 
 >[Core Data] Improve save performance ? (From: Eric Morand <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: AurĂ©lien HugelĂ© <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: Eric Morand <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: mmalcolm crawford <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: "Timothy J. Wood" <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: Eric Morand <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: Kay Roepke <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: Eric Morand <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: Scott Ellsworth <email@hidden>)
 >Re: [Core Data] Improve save performance ? (From: Eric Morand <email@hidden>)

  • Prev by Date: Re: basic data passing question
  • Next by Date: Re: [Core Data] Improve save performance ?
  • Previous by thread: Re: [Core Data] Improve save performance ?
  • Next by thread: Re: [Core Data] Improve save performance ?
  • Index(es):
    • Date
    • Thread