Re: Experience with keyed archiving forward/backwards compatibility?
Re: Experience with keyed archiving forward/backwards compatibility?
- Subject: Re: Experience with keyed archiving forward/backwards compatibility?
- From: Graham Cox <email@hidden>
- Date: Sun, 01 Sep 2013 19:40:34 +0200
On 01/09/2013, at 5:07 PM, Marcel Weiher <email@hidden> wrote:
> Well, archiving in general is pretty convenient, I am just trying to figure out how significant the benefits of keyed archiving are in particular (as compared to, for example, old style archiving). If you’re on iOS you don’t have a choice, but otherwise it seems the benefits are fairly slim, considering the 2-4x performance penalty.
I'm not sure I'd agree that the benefits are slim. With classic archiving, you have to read all the items, in the correct order (if I understand it correctly; I've never used classic Cocoa archiving, only keyed). With keyed you can pick and choose what you want, ignoring what you don't want, and that is at the heart of super-simple backward compatibility, and to a large extent forward compatibility (since you know an older app will totally ignore anything new you add to an archive).
These days you should also be passing the class of expected objects for security reasons - I haven't updated my code to do that yet, but it might have some impact on the forward-compatibility mechanisms such as class substitution.
As for performance…. well, I would say that profiling needs to be used to find out if any slowness is due to the archiving itself. You might be able to mitigate it by using background reads and writes anyway, which is something NSDocument encourages.
--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