mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Optimizes qdel related things (slight init time savings) (#70729)
* Moves spawners and decals to a different init/delete scheme Rather then fully creating and then immediately deleting these things, we instead do the bare minimum. This is faster, if in theory more fragile. We should be safe since any errors should be caught in compile since this is very close to a "static" action. It does mean these atoms cannot use signals, etc. * Potentially saves init time, mostly cleans up a silly pattern We use sleeps and INVOKE_ASYNC to ensure that handing back turfs doesn't block a space reservation, but this by nature consumes up to the threshold and a bit more of whatever working block we were in. This is silly. Should just be a subsystem, so I made it one, with support for awaiting its finish if you want to * Optimizes garbage/proc/Queue slightly Queue takes about 1.6 seconds to process 26k items right now. The MASSIVE majority of this time is spent on using \ref This is because \ref returns a string, and that string requires being inserted into the global cache of strings we store What I'm doing is caching the result of ANY \ref on the datum it's applied to. This ensures previous uses will never decay from the string tree. This saves about 0.2 seconds of init
This commit is contained in:
@@ -167,17 +167,16 @@
|
||||
color = "#00FF00"
|
||||
|
||||
/obj/effect/spawner/round_default_module/Initialize(mapload)
|
||||
..()
|
||||
. = ..()
|
||||
var/datum/ai_laws/default_laws = get_round_default_lawset()
|
||||
//try to spawn a law board, since they may have special functionality (asimov setting subjects)
|
||||
for(var/obj/item/ai_module/core/full/potential_lawboard as anything in subtypesof(/obj/item/ai_module/core/full))
|
||||
if(initial(potential_lawboard.law_id) != initial(default_laws.id))
|
||||
continue
|
||||
potential_lawboard = new potential_lawboard(loc)
|
||||
return INITIALIZE_HINT_QDEL
|
||||
return
|
||||
//spawn the fallback instead
|
||||
new /obj/item/ai_module/core/round_default_fallback(loc)
|
||||
return INITIALIZE_HINT_QDEL
|
||||
|
||||
///When the default lawset spawner cannot find a module object to spawn, it will spawn this, and this sets itself to the round default.
|
||||
///This is so /datum/lawsets can be picked even if they have no module for themselves.
|
||||
|
||||
Reference in New Issue
Block a user