Merge pull request #13380 from Putnam3145/cache-locality-experiments
(TESTMERGE THIS FIRST WOW) Made monstermos faster and more convenient
This commit is contained in:
@@ -16,7 +16,6 @@ SUBSYSTEM_DEF(air)
|
||||
var/cost_atmos_machinery = 0
|
||||
var/cost_equalize = 0
|
||||
|
||||
var/list/active_turfs = list()
|
||||
var/list/hotspots = list()
|
||||
var/list/networks = list()
|
||||
var/list/pipenets_needing_rebuilt = list()
|
||||
@@ -54,13 +53,16 @@ SUBSYSTEM_DEF(air)
|
||||
msg += "PN:[round(cost_pipenets,1)]|"
|
||||
msg += "AM:[round(cost_atmos_machinery,1)]"
|
||||
msg += "} "
|
||||
msg += "AT:[active_turfs.len]|"
|
||||
var/active_turfs_len = get_amt_active_turfs()
|
||||
msg += "AT:[active_turfs_len]|"
|
||||
msg += "EG:[get_amt_excited_groups()]|"
|
||||
msg += "HS:[hotspots.len]|"
|
||||
msg += "PN:[networks.len]|"
|
||||
msg += "HP:[high_pressure_delta.len]|"
|
||||
msg += "AS:[active_super_conductivity.len]|"
|
||||
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
|
||||
msg += "GA:[get_amt_gas_mixes()]|"
|
||||
msg += "MG:[get_max_gas_mixes()]|"
|
||||
msg += "AT/MS:[round((cost ? active_turfs_len/cost : 0),0.1)]"
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/air/Initialize(timeofday)
|
||||
@@ -70,9 +72,11 @@ SUBSYSTEM_DEF(air)
|
||||
setup_atmos_machinery()
|
||||
setup_pipenets()
|
||||
gas_reactions = init_gas_reactions()
|
||||
extools_update_reactions()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/air/proc/extools_update_ssair()
|
||||
/datum/controller/subsystem/air/proc/extools_update_reactions()
|
||||
|
||||
/datum/controller/subsystem/air/fire(resumed = 0)
|
||||
var/timer = TICK_USAGE_REAL
|
||||
@@ -237,6 +241,8 @@ SUBSYSTEM_DEF(air)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_turf_equalize(resumed = 0)
|
||||
return process_turf_equalize_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag)
|
||||
/*
|
||||
//cache for sanic speed
|
||||
var/fire_count = times_fired
|
||||
if (!resumed)
|
||||
@@ -251,8 +257,11 @@ SUBSYSTEM_DEF(air)
|
||||
//equalize_pressure_in_zone(T, fire_count)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
*/
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_active_turfs(resumed = 0)
|
||||
return process_active_turfs_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag)
|
||||
/*
|
||||
//cache for sanic speed
|
||||
var/fire_count = times_fired
|
||||
if (!resumed)
|
||||
@@ -266,10 +275,10 @@ SUBSYSTEM_DEF(air)
|
||||
T.process_cell(fire_count)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
*/
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_excited_groups(resumed = 0)
|
||||
if(process_excited_groups_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag))
|
||||
sleep()
|
||||
return process_excited_groups_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag)
|
||||
/*
|
||||
if (!resumed)
|
||||
src.currentrun = excited_groups.Copy()
|
||||
@@ -288,13 +297,20 @@ SUBSYSTEM_DEF(air)
|
||||
return
|
||||
*/
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_active_turfs_extools()
|
||||
/datum/controller/subsystem/air/proc/process_turf_equalize_extools()
|
||||
/datum/controller/subsystem/air/proc/process_excited_groups_extools()
|
||||
/datum/controller/subsystem/air/proc/get_amt_excited_groups()
|
||||
/datum/controller/subsystem/air/proc/get_amt_active_turfs()
|
||||
/datum/controller/subsystem/air/proc/get_amt_gas_mixes()
|
||||
/datum/controller/subsystem/air/proc/get_max_gas_mixes()
|
||||
/datum/controller/subsystem/air/proc/add_to_active_extools()
|
||||
/datum/controller/subsystem/air/proc/remove_from_active_extools()
|
||||
/datum/controller/subsystem/air/proc/get_active_turfs()
|
||||
/datum/controller/subsystem/air/proc/clear_active_turfs()
|
||||
|
||||
/datum/controller/subsystem/air/proc/remove_from_active(turf/open/T)
|
||||
active_turfs -= T
|
||||
if(currentpart == SSAIR_ACTIVETURFS)
|
||||
currentrun -= T
|
||||
remove_from_active_extools(T)
|
||||
#ifdef VISUALIZE_ACTIVE_TURFS
|
||||
T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, "#00ff00")
|
||||
#endif
|
||||
@@ -308,9 +324,7 @@ SUBSYSTEM_DEF(air)
|
||||
T.add_atom_colour("#00ff00", TEMPORARY_COLOUR_PRIORITY)
|
||||
#endif
|
||||
T.set_excited(TRUE)
|
||||
active_turfs |= T
|
||||
if(currentpart == SSAIR_ACTIVETURFS)
|
||||
currentrun |= T
|
||||
add_to_active_extools(T)
|
||||
if(blockchanges)
|
||||
T.eg_garbage_collect()
|
||||
else if(T.flags_1 & INITIALIZED_1)
|
||||
@@ -335,12 +349,11 @@ SUBSYSTEM_DEF(air)
|
||||
|
||||
/datum/controller/subsystem/air/proc/setup_allturfs()
|
||||
var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz))
|
||||
var/list/active_turfs = src.active_turfs
|
||||
var/times_fired = ++src.times_fired
|
||||
|
||||
// Clear active turfs - faster than removing every single turf in the world
|
||||
// one-by-one, and Initalize_Atmos only ever adds `src` back in.
|
||||
active_turfs.Cut()
|
||||
clear_active_turfs()
|
||||
|
||||
for(var/thing in turfs_to_init)
|
||||
var/turf/T = thing
|
||||
@@ -348,28 +361,27 @@ SUBSYSTEM_DEF(air)
|
||||
continue
|
||||
T.Initalize_Atmos(times_fired)
|
||||
CHECK_TICK
|
||||
|
||||
if(active_turfs.len)
|
||||
var/starting_ats = active_turfs.len
|
||||
var/starting_ats = get_amt_active_turfs()
|
||||
if(starting_ats)
|
||||
sleep(world.tick_lag)
|
||||
var/timer = world.timeofday
|
||||
log_mapping("There are [starting_ats] active turfs at roundstart caused by a difference of the air between the adjacent turfs. You can see its coordinates using \"Mapping -> Show roundstart AT list\" verb (debug verbs required).")
|
||||
for(var/turf/T in active_turfs)
|
||||
var/list/turfs_to_check = get_amt_active_turfs()
|
||||
for(var/T in turfs_to_check)
|
||||
GLOB.active_turfs_startlist += T
|
||||
|
||||
//now lets clear out these active turfs
|
||||
var/list/turfs_to_check = active_turfs.Copy()
|
||||
do
|
||||
var/list/new_turfs_to_check = list()
|
||||
for(var/turf/open/T in turfs_to_check)
|
||||
new_turfs_to_check += T.resolve_active_graph()
|
||||
CHECK_TICK
|
||||
|
||||
active_turfs += new_turfs_to_check
|
||||
for(var/T in new_turfs_to_check)
|
||||
add_to_active_extools(T)
|
||||
turfs_to_check = new_turfs_to_check
|
||||
|
||||
while (turfs_to_check.len)
|
||||
var/ending_ats = active_turfs.len
|
||||
var/ending_ats = get_amt_active_turfs()
|
||||
/*for(var/thing in excited_groups)
|
||||
var/datum/excited_group/EG = thing
|
||||
//EG.self_breakdown(space_is_all_consuming = 1)
|
||||
@@ -445,6 +457,8 @@ SUBSYSTEM_DEF(air)
|
||||
|
||||
return pipe_init_dirs_cache[type]["[dir]"]
|
||||
|
||||
/proc/get_extools_benchmarks()
|
||||
|
||||
#undef SSAIR_PIPENETS
|
||||
#undef SSAIR_ATMOSMACHINERY
|
||||
#undef SSAIR_ACTIVETURFS
|
||||
|
||||
Reference in New Issue
Block a user