• 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: NSDocument save incremental file package in-place
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument save incremental file package in-place


  • Subject: Re: NSDocument save incremental file package in-place
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 01 Mar 2014 09:43:22 -0800

On Mar 1, 2014, at 07:23 , Trygve Inda <email@hidden> wrote:

> The problem is that when there is a very small change (just adding or
> removing one of the files in the package), the system does not save in
> place.
>
> Rather it reads the previous package file completely, writes out a copy of
> the package (400 MB) and then renames it.
>
> How can I get it to save in place?

AFAIK, NSDocument never saves in place, and isn’t intended to (for safety reasons — what happens if your app crashes after some of the files have been updated but not others?).

Instead, it achieves its package performance optimization by hard-linking unchanged files in the new (saved) package to files in the old (original) package. If your save is taking 40 seconds, that could mean:

— The document is on a file system that doesn’t support hard linking.

— The document is on a file system where hard linking 7500 files takes 40 seconds.

— You didn’t preserve the original file sub-wrappers from the directory wrapper created when the document was opened, so NSDocument thinks all the files have changed. Note that it’s undocumented (again, AFAIK) what criteria NSDocument uses** to decide when a particular file wrapper represents “no change”, so it’s safest to keep the original NSFileWrapper objects from open time until save time.



** The most likely possibilities are ‘==’ on file wrappers, ‘isEqual:’ on file wrappers, or comparison of mod date and/or size of the actual files, but it could be something more obscure.

_______________________________________________

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: NSDocument save incremental file package in-place
      • From: Trygve Inda <email@hidden>
References: 
 >NSDocument save incremental file package in-place (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: NSPredicate speed improvement?
  • Next by Date: Re: NSDocument save incremental file package in-place
  • Previous by thread: NSDocument save incremental file package in-place
  • Next by thread: Re: NSDocument save incremental file package in-place
  • Index(es):
    • Date
    • Thread