From 055a813d1e1a914c147bb36dc162f0037c45f308 Mon Sep 17 00:00:00 2001 From: itsmeow Date: Sat, 17 Feb 2024 04:39:12 -0600 Subject: [PATCH] Optimize PDA painter init, improve init tracking (#10438) --- code/_compile_options.dm | 5 ++++- code/controllers/subsystem/atoms.dm | 7 ++++--- code/game/machinery/PDApainter.dm | 18 ------------------ 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index b212c301d0dc2..303a8c1ed836a 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -42,7 +42,10 @@ #define ZMIMIC_LIGHT_BLEED /// If this is uncommented, will profile mapload atom initializations -// #define PROFILE_MAPLOAD_INIT_ATOM +//#define PROFILE_MAPLOAD_INIT_ATOM +#ifdef PROFILE_MAPLOAD_INIT_ATOM +#warn PROFILE_MAPLOAD_INIT_ATOM creates very large profiles, do not leave this on! +#endif //#define UNIT_TESTS //If this is uncommented, we do a single run though of the game setup and tear down process with unit tests in between diff --git a/code/controllers/subsystem/atoms.dm b/code/controllers/subsystem/atoms.dm index 16365b44a89ad..cb32f91ddeca2 100644 --- a/code/controllers/subsystem/atoms.dm +++ b/code/controllers/subsystem/atoms.dm @@ -48,7 +48,7 @@ SUBSYSTEM_DEF(atoms) #ifdef PROFILE_MAPLOAD_INIT_ATOM #define PROFILE_INIT_ATOM_BEGIN(...) var/__profile_stat_time = TICK_USAGE -#define PROFILE_INIT_ATOM_END(atom) mapload_init_times[##atom.type] += TICK_USAGE_TO_MS(__profile_stat_time) +#define PROFILE_INIT_ATOM_END(atom) mapload_init_times += list(list(##atom.type, TICK_USAGE_TO_MS(__profile_stat_time))) #else #define PROFILE_INIT_ATOM_BEGIN(...) #define PROFILE_INIT_ATOM_END(...) @@ -90,8 +90,9 @@ SUBSYSTEM_DEF(atoms) #ifdef PROFILE_MAPLOAD_INIT_ATOM var/list/lines = list() lines += "Atom Path,Initialisation Time (ms)" - for (var/atom_type in mapload_init_times) - var/time = mapload_init_times[atom_type] + for (var/data in mapload_init_times) + var/atom_type = data[1] + var/time = data[2] lines += "[atom_type],[time]" rustg_file_write(jointext(lines, "\n"), "[GLOB.log_directory]/init_times.csv") #endif diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index 4d87201398e43..1aaf74eeaa1cb 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -53,7 +53,6 @@ "Misc: Prisoner" = "pda-prisoner" ) max_integrity = 200 - var/list/colorlist = list() /obj/machinery/pdapainter/on_emag(mob/user) ..() @@ -83,23 +82,6 @@ return -/obj/machinery/pdapainter/Initialize(mapload) - . = ..() - var/list/blocked = list( - /obj/item/modular_computer/tablet/pda/heads, - /obj/item/modular_computer/tablet/pda/clear, - /obj/item/modular_computer/tablet/pda/syndicate, - /obj/item/modular_computer/tablet/pda/chameleon, - /obj/item/modular_computer/tablet/pda/chameleon/broken) - - for(var/P in typesof(/obj/item/modular_computer/tablet/pda) - blocked) - var/obj/item/modular_computer/tablet/pda/D = new P - - //D.name = "PDA Style [colorlist.len+1]" //Gotta set the name, otherwise it all comes up as "PDA" - D.name = D.icon_state //PDAs don't have unique names, but using the sprite names works. - - src.colorlist += D - /obj/machinery/pdapainter/Destroy() QDEL_NULL(storedpda) QDEL_NULL(storedid)