I wrote a simple command line tool for a special need to convert a specific ini file to a property list. I am using NSPropertyListSerialization
to write the Dictionary to a binary property list file of 307kb. However when I write it to XML and after convert it using plutil to a binary property list the file is only 224kb in size.
I'd like to save as much data as possible but I also want to stay away from NSTask
. The question here is, how would I achieve the same results from code as I achieve using plutil
.
According to this very old thread,
plutil
will look for identical sub-trees such as arrays and unique them in the resulting plist.NSPropertyListSerialization
used to do this a long time ago, but this was removed because the process is relatively slow and developers expect the serialization to work as fast as possible.After googling around it doesn't look like it will be easy to find code to do this yourself. You may just have to deal with the small difference in size, or attempt to roll your own serializer.