performance improvement for process_cell() (#62730)

About The Pull Request

Increase performances on /turf/open/process_cell() by changing a typed for and making use of as anything, plus removed unnecessary proc call
Why It's Good For The Game

The test has been done in a controlled environment, a 7x7 airless room with one canister of plasma and one canister of oxygen released inside. The profiling ran from the start of the fire to the end of it.
Before any changes:
image
After the as anything forloop:
image
After the archive() removal:
image
Changelog

cl
code: increased atmos performances a bit more
/cl
This commit is contained in:
Ghilker
2021-12-02 11:03:20 +13:00
committed by GitHub
parent 2af1845511
commit 8fee01e33a
2 changed files with 10 additions and 9 deletions
@@ -70,3 +70,8 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define TURFS_CAN_SHARE(T1, T2) (LAZYACCESS(T2.atmos_adjacent_turfs, T1) || LAZYLEN(T1.atmos_adjacent_turfs & T2.atmos_adjacent_turfs))
//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
#define LINDA_CYCLE_ARCHIVE(turf)\
turf.air.archive();\
turf.archived_cycle = SSair.times_fired;\
turf.temperature_archived = turf.temperature;
@@ -145,9 +145,7 @@
temperature_archived = temperature
/turf/open/archive()
air.archive()
archived_cycle = SSair.times_fired
temperature_archived = temperature
LINDA_CYCLE_ARCHIVE(src)
/////////////////////////GAS OVERLAYS//////////////////////////////
@@ -242,7 +240,7 @@
/turf/open/process_cell(fire_count)
if(archived_cycle < fire_count) //archive self if not already done
archive()
LINDA_CYCLE_ARCHIVE(src)
current_cycle = fire_count
var/cached_ticker = significant_share_ticker
@@ -259,12 +257,10 @@
max_share = 0 //Gotta reset our tracker
#endif
for(var/t in adjacent_turfs)
var/turf/open/enemy_tile = t
for(var/turf/open/enemy_tile as anything in adjacent_turfs)
if(fire_count <= enemy_tile.current_cycle)
continue
enemy_tile.archive()
LINDA_CYCLE_ARCHIVE(enemy_tile)
/******************* GROUP HANDLING START *****************************************************************/
@@ -311,7 +307,7 @@
if (planetary_atmos) //share our air with the "atmosphere" "above" the turf
var/datum/gas_mixture/planetary_mix = SSair.planetary[initial_gas_mix]
// archive ourself again so we don't accidentally share more gas than we currently have
archive()
LINDA_CYCLE_ARCHIVE(src)
if(our_air.compare(planetary_mix))
if(!our_excited_group)
var/datum/excited_group/new_group = new