johanwanderer -> RE: Takes ages to save distant world (7/14/2014 8:06:01 PM)
|
I like to compare to with printing. Let's say if you want to print a 100-page document 5 times, you have two options, with and without collating. Without collating, the printer will print the 1st page 5 times, then the 2nd page 5 times, etc. while only incur the printing setup for each page once. With collating, the printer will print the enter document once, then go back and print it again, incurring the setup penalty at every page. I suspect something similar is happening in the Distant Worlds saving process. The game iterate through the whole graph of the galaxy, loading it (possibly incur a memory swap), then serialize/save it to the compressed save stream. There's probably some iteration code in there that uses a O(n2) (or worse) loop to pick through the game elements to save. With my setup, (quad-core CPU, 6 GB RAM, 16TB game disk on a RAID-6) my current game (95+ years in, 700 stars galaxy, 140+MB save size) takes over 20 minutes to save now. While saving, the game uses 25% of CPU (or 100% on one core). I notice that the save time starts to get works after you get to about the 90MB mark. before that, I would happily leave it on 30-minutes autosave. Afterward, it gets progressively slower, and at this point I can no longer use autosave. All of this is to support my claim about the O(n2+) iteration above, and to say that the saving process is CPU-bound. I listed my game setup to illustrate that it's not just the galaxy's size but also the complexity of it. I have over 500 mini-carriers in my game, so over 4000 fighters in my empire; all of which need saving. Maybe the Devs can have an option to just create a memory-mapped save file, and basically dump the whole 1.5 GB to disk and copy it (for auto-save). That'll probably takes a whole lot less time for me :)
|
|
|
|