Removes the excited cleanup subprocess (#57381)

When I was in the process of developing my atmos fixes/optimizations, I focused heavily on maintaining the area
of excited groups, since growing delayed self_breakdown(), and lead to shitty behavior which I thought was the
result of my sleeping changes.

This was not the case, those who came before me knew better, as always.

Especially now, since I've unhooked breakdown from excited groups gaining new tiles, my concern was unfounded,
and actually lead to shitty behavior and wasted time.

I failed to recognize the value in random garbage_collect()s, they help prevent mass gas equalization over large
spaces, they make gas appear to move more consistently when in these large spaces, and they lessen the amount of
self_breakdown()s over large turf lists, which is very helpful for lowering the overall overtime of the
subsystem.

This fixes my mistake, and purges the excited cleanup subprocess from the air subsystem. It's free real estate
babyyyyyyyy.
This commit is contained in:
LemonInTheDark
2021-03-04 13:13:56 -08:00
committed by GitHub
parent 07e7d04813
commit 943afb19c9
7 changed files with 15 additions and 114 deletions

View File

@@ -10,7 +10,6 @@ SUBSYSTEM_DEF(air)
var/cost_atoms = 0
var/cost_turfs = 0
var/cost_hotspots = 0
var/cost_ex_cleanup = 0
var/cost_groups = 0
var/cost_highpressure = 0
var/cost_superconductivity = 0
@@ -19,7 +18,6 @@ SUBSYSTEM_DEF(air)
var/cost_rebuilds = 0
var/list/excited_groups = list()
var/list/cleanup_ex_groups = list()
var/list/active_turfs = list()
var/list/hotspots = list()
var/list/networks = list()
@@ -51,7 +49,6 @@ SUBSYSTEM_DEF(air)
msg += "C:{"
msg += "AT:[round(cost_turfs,1)]|"
msg += "HS:[round(cost_hotspots,1)]|"
msg += "CL:[round(cost_ex_cleanup, 1)]|"
msg += "EG:[round(cost_groups,1)]|"
msg += "HP:[round(cost_highpressure,1)]|"
msg += "SC:[round(cost_superconductivity,1)]|"
@@ -62,7 +59,6 @@ SUBSYSTEM_DEF(air)
msg += "} "
msg += "AT:[active_turfs.len]|"
msg += "HS:[hotspots.len]|"
msg += "CL:[cleanup_ex_groups.len]|"
msg += "EG:[excited_groups.len]|"
msg += "HP:[high_pressure_delta.len]|"
msg += "SC:[active_super_conductivity.len]|"
@@ -149,18 +145,6 @@ SUBSYSTEM_DEF(air)
return
cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(cached_cost))
resumed = FALSE
currentpart = SSAIR_EXCITEDCLEANUP
if(currentpart == SSAIR_EXCITEDCLEANUP)
timer = TICK_USAGE_REAL
if(!resumed)
cached_cost = 0
process_excited_cleanup(resumed)
cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
cost_ex_cleanup = MC_AVERAGE(cost_ex_cleanup, TICK_DELTA_TO_MS(cached_cost))
resumed = FALSE
currentpart = SSAIR_EXCITEDGROUPS
if(currentpart == SSAIR_EXCITEDGROUPS)
@@ -312,30 +296,6 @@ SUBSYSTEM_DEF(air)
if (MC_TICK_CHECK)
return
/datum/controller/subsystem/air/proc/process_excited_cleanup(resumed = FALSE)
//cache for sanic speed
var/fire_count = times_fired
if (!resumed)
src.currentrun = cleanup_ex_groups.Copy()
cleanup_ex_groups.Cut() //Cut the list here so any later breakdowns get added properly
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/list/turf_packet = currentrun[currentrun.len]
var/breakdown = turf_packet[EX_CLEANUP_BREAKDOWN]
var/dismantle = turf_packet[EX_CLEANUP_DISMANTLE]
var/list/turf_list = turf_packet[EX_CLEANUP_TURFS]
while(turf_list.len) //The turf list
var/turf/open/T = turf_list[turf_list.len]
//I'd normally check for nulls here, but turfs are dumb with refs, so it's not an issue
//We don't allow planetary turfs as a semi stopgap to worldspanning groups
if(istype(T) && !istype(T.air, /datum/gas_mixture/immutable) && !T.planetary_atmos)
T.cleanup_group(fire_count, breakdown, dismantle)
turf_list.len--
if (MC_TICK_CHECK)
return
currentrun.len-- //If we process all the turfs in a packet, del it.
/datum/controller/subsystem/air/proc/process_excited_groups(resumed = FALSE)
if (!resumed)
src.currentrun = excited_groups.Copy()
@@ -366,7 +326,7 @@ SUBSYSTEM_DEF(air)
if(T.excited_group)
//If this fires during active turfs it'll cause a slight removal of active turfs, as they breakdown if they have no excited group
//The group also expands by a tile per rebuild on each edge, suffering
T.excited_group.garbage_collect(will_cleanup = TRUE) //Poke everybody in the group and reform
T.excited_group.garbage_collect() //Kill the excited group, it'll reform on its own later
///Puts an active turf to sleep so it doesn't process. Do this without cleaning up its excited group.
/datum/controller/subsystem/air/proc/sleep_active_turf(turf/open/T)
@@ -404,10 +364,6 @@ SUBSYSTEM_DEF(air)
else
T.requires_activation = TRUE
/datum/controller/subsystem/air/proc/add_to_cleanup(datum/excited_group/ex_grp)
//Store the cooldowns. If we're already doing cleanup, DO NOT add to the currently processing list, infinite loop man bad.
cleanup_ex_groups += list(list(ex_grp.breakdown_cooldown, ex_grp.dismantle_cooldown, ex_grp.turf_list.Copy()))
/datum/controller/subsystem/air/StartLoadingMap()
LAZYINITLIST(queued_for_activation)
map_loading = TRUE