On 25/02/2016 01:20, Matthew Fernandez wrote:
The na?ve ways I can see of working around (1) are either (a) construct the entire state in memory first then stream it out to a compressed file, (b) effectively run the save state logic twice to predict the offset values in the first pass so the second pass that does the actual writing can run linearly uninterrupted or (c) write the state out then compress it to a second file and delete the first. None of these are particularly palatable to me. David, you mentioned that it might be possible to avoid the seeks. Did you have a different idea?
As you've noted, there are also seeks on the load path, but to me this is a lesser hurdle to overcome than the seeks on the save path.
The main use of seeks in the code is to get the parent name and, if necessary, to change it. ShowParent seeks to the file name to read and return it, RenameParent writes a new one and updates the location on disc.
If the loading sequence exactly mirrored the saving there would be no need for seeks for the relocations. It might be possible to make that change but I'm rather reluctant to change the code until we know that it would be worthwhile.
David