• 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: Bill Bumgarner <email@hidden>
  • Date: Mon, 16 Jan 2006 15:57:52 -0800

On Jan 16, 2006, at 3:01 PM, Eric Morand wrote:
- SQLite : around 0.450 second
- XML : around 0.005 second !!!

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

More likely than not, the problem has to do with SQLite's desire to ensure that the bytes are actually written through to the drive platter. fsync() does not do that; not on Mac OS X, not on Linux, nor on any other Unix platform.


Instead, SQLite sends a F_FULLFSYNC request down to the kernel. This causes the kernel to flush all buffers to the drives and causes the drives to flush their track caches. Without this, there is a significantly large window of time within which your data is going to be sitting in volatile memory.

Ridiculous Fish has a nice writeup on the whole subject, including links to some relevant discussions in other forums:

	http://ridiculousfish.com/blog/?p=17

The same calls are not made for XML or Binary stores. Since they are atomic, the chance for data loss that involves corruption of the file is a lot less, especially since the writes are typically atomic and involve keeping the old file around.

Since SQLite is updating part of a file and loss of that partial update would be catastrophic, Core Data (through SQLite) goes to greater lengths to ensure that the bytes are really written.

Unfortunately, there is no way to flush the track cache for just one file. It is an all or none kind of deal.

b.bum

_______________________________________________
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: Ligatures - or more so not ligatures
  • Next by Date: Re: C++/ObjC Distributed Objects
  • Previous by thread: Re: [Core Data] Improve save performance ?
  • Next by thread: Re: [Core Data] Improve save performance ?
  • Index(es):
    • Date
    • Thread