Re: Progress for archiving/dearchiving
Re: Progress for archiving/dearchiving
- Subject: Re: Progress for archiving/dearchiving
- From: Graham Cox <email@hidden>
- Date: Mon, 16 Sep 2013 17:24:09 +0200
On 16/09/2013, at 4:25 PM, Chris Devereux <email@hidden> wrote:
> How about tracking the number of written objects when saving the document,
> then encoding an additional key containing the object count at the top
> level of the archive? This could then be retrieved before decoding the root
> object.
>
> A possible problem with this idea is that it might require the data for the
> root object to be read into memory before the count can be read. Maybe this
> wouldn't be a problem with a binary format --- I don't know enough about
> the implementation of NSKeyedArchiver/Unarchiver to be sure.
I was thinking along these lines but I was hoping to come up with something that would work for existing archives that don't have the extra info. I don't know how much lazy loading NSKeyedUnarchiver does - it might get read or mapped into memory anyway. Perhaps there's a fairly quick way to count the number of objects in it?
My file format is actually a package that has an auxiliary plist independent of the archive, so I could store a value there which would avoid loading the archive just to get that number, but that would only be for archives I write in future.
--Graham
_______________________________________________
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