aliens

Author Topic: Battlescape Save/Load speedup and file shrink  (Read 4022 times)

Offline alienfood

  • Captain
  • ***
  • Posts: 79
  • It's people!
    • View Profile
Battlescape Save/Load speedup and file shrink
« on: November 28, 2012, 01:08:05 am »
Battlescape saves contain much repetitive data, e.g. smoke is almost always 0, most mapData contains -1, -1, -1.

The patch affects only tile.cpp, and checks the data it is about to save. For each tile, it elides data from the save if it is "predictable". Equally, during load, each tile checks whether a value node exists before trying to load it; if the node is not available it inserts this "predictable" value instead.

My battlescape saves have gone from 601kb to 347kb, and my load times (oldish i7 laptop with SSD) from about 60 seconds to 45 seconds.

The patch is backward-compatible with existing saves, but don't overwrite your old saves if you want to be able to remove the patch.

Offline alienfood

  • Captain
  • ***
  • Posts: 79
  • It's people!
    • View Profile
Re: Battlescape Save/Load speedup and file shrink
« Reply #1 on: November 28, 2012, 02:04:29 am »
I have no idea if the change is up there, or what the hell. If I did something stupid, which seems likely, let me know. I was hoping to reuse my fork or maybe my branch, but should I delete everything and start from nul for every change?

Offline karvanit

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Battlescape Save/Load speedup and file shrink
« Reply #2 on: November 28, 2012, 05:21:34 am »
It is generally a good idea to keep things separate (in different branches) if they are different concepts.
eg All save/load code with defaut values is one concept. Implementing alien research is another.

This way the upstream developers can pick what they want, in the order they like.