Re: Archiving *lots* of instances to disk
Re: Archiving *lots* of instances to disk
- Subject: Re: Archiving *lots* of instances to disk
- From: Jonathan Jackel <email@hidden>
- Date: Wed, 26 Jan 2005 07:08:37 -0500
You ought to test your program under realistic circumstances before
deciding that you need to reengineer it. It almost certainly will not
take 50x time to store 50x the data. Get some test data and try it.
That said, there have been many discussions here about the relative
performance of NSArchiver v. NSKeyedArchiver. Keyed archiving is great
because it allows you to change the objects you archive and still
provide backward compatibility (for free). Non-keyed archiving makes
this more difficult, but not impossible. If you don't need keyed
archiving's pluses, you don't have to live with its minuses. Try
NSArchiver instead.
Jonathan
On Jan 26, 2005, at 5:58 AM, Kiel Gillard wrote:
Hey guys,
I'd like to know what you guys think I could do about my situation
here: I have 2 mutable dictionaries and 1 mutable array which i need
to save to disk, so users can restore these instances the next time
they start up my program.
Each collection contains instances/objects of custom classes I've
made, and each object contains one or many arrays, dictionaries and
multiple strings/numbers/attributed strings.
I currently use +[NSKeyedArchiver archiveRootObject: toFile:] to
archive a root object which contains two dictionaries with 30 keys and
values and 2 objects in the mutable array. This takes about .25 of a
second to save everything to one file. Realistically, I'm looking at
many times more objects being used - 500 odd in one dictionary and
about 1500 in another.
I've thought of the following options I could take to work around the
delay:
1) Breaking the file into a file for each collection - but it will
still take an unacceptable amount of time.
2) Calling the save method in a thread - is this a good idea? I'll
obviously have to use NSLocks to prevent the data changing on the
thread.
3) In a thread, saving the 3 different collections independently,
depending on which one was changed.
Is there any other options I could use?
Thanks guys!
Kiel :-)
_______________________________________________
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
_______________________________________________
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