Saving *lots* of instances to disk
Saving *lots* of instances to disk
- Subject: Saving *lots* of instances to disk
- From: "Kiel Gillard" <email@hidden>
- Date: Wed, 26 Jan 2005 03:57:43 -0700
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