Is it possible to save only the changed parts of a property list object?

It is possible to write the entire dictionary to a property list object, but I would like to make my application more efficient by only writing out parts of the changed property list.

Let's say I have a property list with multiple dictionaries under the root node. I would like to modify one dictionary and keep it, but it is not necessary to write a complete list of properties (including unmodified dictionaries). Are there any ways to get around this? thank!

+1


source to share


2 answers


There is no way to do what you want. However, you should be aware that CoreFoundation has been heavily optimized for reading / writing plist files. You don't even have to start worrying about something like this until it shows up in profiling as a bottleneck.



+3


source


If you're talking about writing a dictionary to a file, I don't think there is a way around it all.

Changing one element can change the length of the file, which will change the position of everything else in the file, so it will not be possible to write only the changed elements.



The only reason I could see I want to do this is if you have a huge file that changes frequently and takes a long time to write. If so, you might want to break down the property list into smaller, more manageable sections that you can read and write individually.

+1


source







All Articles