Optimizes changing z level as a ghost by something like 85% (#73005)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->
## About The Pull Request
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->
Optimizes hud image addition/removal on z change
We were doing a lot of repeated work here, not to mention all the proc
calls.
So I pushed the "operate on loops" behavior into its own proc, so I
could ensure we only do some of this stuff once
This plus some removal of safeties saves 75% of the cost of z level
transitions as a ghost
Prevents double on_changed_z_level calls from ghosts and shuttles
Reacting to z changes used to be done off doMove or one of those
children, timber moved it to Moved, but did not remove the calls that
assumed things like abstract_move wouldn't trigger it
This means that moving up/down as a ghost was causing a double call of
the whole z move stack. Suprised this never broke anything tbh
Makes csv stat tracking actually encode numbers properly, cleans up an
indev comment from plane group code
## Why It's Good For The Game
Speed, and fixes
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
* Add EXPORT_STATS_TO_FILE_LATER to stat_tracking macros (#70893)
Adds a macro to the stat_tracking macros that lets you export
counts/costs into a JSON file, which is significantly easier to parse
with stuff like jq.
It is delayed because these macros are used to profile potentially
extremely hot functions, where we cannot afford to do I/O every time. It
is sent every second rather than waiting until all are done because it
can also be used to profile functions that are potentially called
constantly, forever.
Usual concerns about unused code being added do not apply as this entire
file is for profiling macros that are only ever used at time of
profiling, and are never ever merged to master.
* Add EXPORT_STATS_TO_FILE_LATER to stat_tracking macros
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
* Overlay per-type cost logging.
Overlays will now log how long each type took to process.
Changed up how overlays was done to account for the fact its a queue and not a processor. (it was using almost none of the processing subsystem framework)
Made the overlay loop faster by making it not cut the list until the end.
Added a simple generic benchmark stat tracking system.
I don't know how much overhead this adds to overlays. i may put it behind testing or something, but i do want to test this on the serbers to get some stats.
* Removes flush() as it was creating race conditions
* Use ref
* text2file
* Atoms added as an overlay will have their pending overlays compiled before being converted to an appearance