mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-09 16:33:50 +00:00
Starts shaving off a lot of less than 0.1s performance killers by, in nearly every case, just writing better code. Numbers are amount saved. - /obj/machinery/bluespace_vendor/LateInitialize -> 29.4ms Changes a loop over all machines to a specialized list. - /obj/structure/table/glass/Initialize -> 42.53ms Stops every table from initializing glass shards and table frames before any destruction. - /obj/structure/chair/Initialize -> 24.64ms Removes an unnecessary addtimer that existed for chairs that weren't anchored in emergency shuttles. Didn't do anything. - /datum/orderable_item/New -> 44.3ms Instead of initializing every item to get its desc, just uses initial. Added a unit test to make sure none are dynamic. - /obj/machinery/computer/slot_machine/Initialize -> 26.19ms Currently goes through every coin subtype, creates it, calls a proc, then qdels it. Changes that to only run once. Could be optimized further by making the coin info on a datum to avoid creating the object, but it currently sits at 7.82ms, far below worth caring about for now. - /obj/machinery/door_buttons/airlock_controller/findObjsByTag -> 3.51ms Loops over just doors instead of typechecking airlock in machines. - /obj/structure/closet/Initialize -> 60.57ms Moves the code for taking everything on the tile from a next-tick timer to LateInitialize. - /obj/machinery/rnd/experimentor/Initialize -> 36.92ms Changes a list that is generated by going through every item in the game and getting information from a large amount of them to only run when needed. - /obj/structure/tank_dispenser/Initialize -> 20.81ms No longer initializes every tank in it right away, only when needed. - /obj/machinery/telecomms/LateInitialize -> 16.63ms Removes `urange` to instead just loop over telecomms machines and check distance. There's not that many of them. - /mob/living/simple_animal/hostile/carp/cayenne/Initialize -> 3.17ms Defers a GAGS overlay creation until its needed. BTW GAGS is *horrendous* on init costs, and is the root cause for a lot of pretty terrible performance. I investigated precompiling but the gains weren't crazy, but likely could be the more stuff is GAGS'd. - /turf/open/floor/engine/cult/Initialize -> 14.64ms Temporary visual effect that is created is no longer done on mapload, since nobody will see it. - /datum/techweb/specialized/autounlocking/proc/autounlock -> 5.55ms Changes some loops to shorter checks. This whole proc is pretty bad and it's still 14.21ms for 17 calls. - /matrix/New -> 13.41ms - /matrix/proc/Translate -> 42.06ms ~~Changed the mineral matrice to only generate once, then take it from a static.~~ An extra ~0.05s taken off by avoiding setting icon and transform every Initialize.