Teardown-Issue-Tracker-Maintainers / Teardown-Issue-Tracker

A public repo for the community to track issues/bugs/feature requests in Teardown.
12 stars 5 forks source link

[Bug] Lag spikes when saving to registry on large savegame.xml #570

Open FlorentP42 opened 4 months ago

FlorentP42 commented 4 months ago

Describe the bug

So I noticed that trying to save data to the registry started causing noticeable lag spikes (0.5s) whenever I tried to save data to the registry in the middle of gameplay. After a little investigation this seems to be directly tied to the size of savegame.xml: I had one of more than 50MB when I noticed that lag, I manually removed some saved data from mods that were taking a lot of space and went down to 11MB, which reduced the lag spike a lot to become barely noticeable.

Steps to reproduce the behavior

  1. Fill your savegame.xml with a lot of dummy data to reach 50MB size or more.
  2. Add the following code to the tick() function of a script:
    if InputPressed("e") then
    local val = GetTime()
    DebugPrint("registry set "..val)
    SetInt("savegame.mod.tmp", val)
    end
  3. Load that script into the game.
  4. Press E a few times and notice the lag spike each time.

Expected behavior

Saving data to the registry remains smooth even when save file becomes huge.

Environment

Additional context

No response

Gregory-Gregory commented 4 months ago

@FlorentP42 hi!

Thank you for reporting this issue. It has been shared with the team for further investigation.