On Sep 17, 2013, at 17:35 , Fritz Anderson <fri...@manoverboard.org> wrote: >> On Sep 16, 2013, at 18:51 , Jeffrey Oleander <jgo...@yahoo.com> wrote: >> >>> If you want to know the total number of objects to be archived, then you >>> need to count them, at some time or another. To count them, you need to >>> walk the object tree before you start actually archiving... which may take >>> a significant fraction of the time it takes to archive. >> >> I doubt that walking the object tree to count would take a significant >> amount of time, unless you have something really weird going on with your >> data structures. >> >> For example, I recently ran some tests on keyed archiving with a 3 level >> tree of slightly more than 1M objects total. Archiving with keyed archiver >> took >9s, unarchiving 2.6s, creating the tree 200ms and counting it 16.5ms. >> >> >> So counting the objects took less than 1% of the time of unarchiving, and >> less than 0.2% the time of archiving, in both cases the time is negligible. > > I'm curious (and I admit to being a bit foggy this morning). The NSCoder > family has long supported graphs that are not directed-acyclic, or in which > objects have more than one reference. How did you handle that?
I didn’t in this case, my objects were a tree. So a simple tree-walker was sufficient. Adding dup-detection for a generic solution would add a little time, but not a lot. Marcel _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com