• 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: Eric Morand <email@hidden>
  • Date: Mon, 16 Jan 2006 21:27:18 +0100

Thanks for the debug argument !

Here is what I obtained with a single save on a newly created managed object :

2006-01-16 21:20:20.448 Freak[21062] save
2006-01-16 21:20:20.449 Freak[21062] CoreData: sql: SELECT F.Z_ENT, F.Z_PK, F.Z_OPT, F.ZTREENODE, F.Z10_TREENODE, F.ZBALANCE, F.ZNAME, F.ZNUMBER, F.ZOPENINGBALANCE, F.ZACCOUNTTYPE, F.ZNAME1, F.ZNAME2, F.ZCATEGORYTYPE, F.ZNAME3, F.ZNAME4, F.ZNAME5, F.ZSUPERCATEGORY, F.ZCREDIT, F.ZDEBIT, F.ZPAYEE, F.ZSUBCATEGORY, F.ZCATEGORY, F.ZACCOUNT FROM ZFREAKMANAGEDOBJECT F WHERE ( F.Z_ENT = ? AND ( (1 = 1) AND NSCoreDataLike( F.ZNAME, ?, 0) ) )
2006-01-16 21:20:20.450 Freak[21062] CoreData: annotation: fetch execution time: 0.001012s
2006-01-16 21:20:20.451 Freak[21062] CoreData: sql: BEGIN
2006-01-16 21:20:20.451 Freak[21062] CoreData: sql: SELECT Z_MAX FROM Z_PRIMARYKEY WHERE Z_ENT = ?
2006-01-16 21:20:20.451 Freak[21062] CoreData: sql: UPDATE Z_PRIMARYKEY SET Z_MAX = ? WHERE Z_ENT = ? AND Z_MAX = ?
2006-01-16 21:20:20.499 Freak[21062] CoreData: sql: COMMIT
2006-01-16 21:20:20.852 Freak[21062] CoreData: sql: BEGIN
2006-01-16 21:20:20.852 Freak[21062] CoreData: sql: INSERT INTO ZFREAKMANAGEDOBJECT(Z_PK, Z_ENT, Z_OPT, ZTREENODE, ZACCOUNTTYPE, Z10_TREENODE, ZBALANCE, ZNAME, ZNUMBER, ZOPENINGBALANCE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2006-01-16 21:20:20.853 Freak[21062] CoreData: sql: UPDATE ZFREAKMANAGEDOBJECT SET ZNAME1 = ?, Z_OPT = ? WHERE Z_PK = 1 AND Z_OPT = 73
2006-01-16 21:20:20.854 Freak[21062] CoreData: sql: COMMIT
2006-01-16 21:20:21.129 Freak[21062] End save


I have added "save" and "End save" NSLog to measure the duration of the save operation. As you can see, it takes 0.7 seconds to save my new objact. Granted the log to the console consumes a lot of time, but even with debug mode disabled, it is still near of 0.5 second.

What is strange is that there is only one fetch here and it lasts... 0.001 second ! What is taking so much time ? The two commits ? Is Core Data that slow ?




Eric.


Le 16 janv. 06 à 19:20, Timothy J. Wood a écrit :


On Jan 16, 2006, at 9:51 AM, mmalcolm crawford wrote:
Are you causing a large number of faults to fire (individually)?

<http://developer.apple.com/documentation/Cocoa/Conceptual/ CoreData/Articles/cdFetching.html#//apple_ref/doc/uid/TP40002484-SW4>

The following information on the 'Troubleshooting' page should really be copied on that performance page:


"""
With Mac OS X version 10.4.3 and later, you can use the user default com.apple.CoreData.SQLDebug to log to stderr the actual SQL sent to SQLite. (Note that user default names are case sensitive.) For example, you can pass the following as an argument to the application:


-com.apple.CoreData.SQLDebug 1

Higher levels of debug numbers produce more information, although this is likely to be of diminishing utility.

The information the output provides can be useful when debugging performance problems—in particular it may tell you when Core Data is performing a large number of small fetches (such as when firing faults individually). Like file I/O, executing many small fetches is expensive compared to executing a single large fetch. For examples of how to correct this situation, see "Performance".

"""

-tim


_______________________________________________ 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

============================================= Automator Ketchup : http://automatorketchup.blogspot.com



_______________________________________________
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: Kay Roepke <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>)

  • Prev by Date: Re: Q: "Linking" to mail messages?
  • Next by Date: Quartz composer drag and drop problems
  • Previous by thread: Re: [Core Data] Improve save performance ?
  • Next by thread: Re: [Core Data] Improve save performance ?
  • Index(es):
    • Date
    • Thread