ColColonCleaner / DNDTools

DND Tools for Tabletop Simulator
GNU General Public License v3.0
10 stars 2 forks source link

Mini Injector - OnSave framerate dips with ~10 injected miniatures on table. #59

Closed ColColonCleaner closed 2 years ago

ColColonCleaner commented 2 years ago

image On the left is without 10 injected minis. The big dip in the middle is building a map with 10 injected miniatures contained. The right side is afterward. Notice the framerate dips every 10 seconds with all those minis loaded due to the OnSave tick.

ColColonCleaner commented 2 years ago

We might be able to get around this by having a trigger after setting changes that generates the JSON with a coroutine before the OnSave function triggers. So essentially the OnSave function can just grab an already created save state string and doesn't need to generate any JSON. That should speed up the save process considerably.

ColColonCleaner commented 2 years ago

We can just set self.script_state when settings are changed, and return self.script_state from onsave.

ColColonCleaner commented 2 years ago

Setting the script state when things change instead of on every onSave greatly improves framerate stability. image