mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-13 10:23:15 +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.
17 lines
724 B
Plaintext
17 lines
724 B
Plaintext
/// Makes sure that no orderable items have dynamic descriptions, if they
|
|
/// don't explicitly set a description.
|
|
/datum/unit_test/orderable_item_descriptions
|
|
|
|
/datum/unit_test/orderable_item_descriptions/Run()
|
|
for (var/datum/orderable_item/orderable_item as anything in subtypesof(/datum/orderable_item))
|
|
if (!isnull(initial(orderable_item.desc)))
|
|
continue
|
|
|
|
var/item_path = initial(orderable_item.item_path)
|
|
|
|
var/obj/item/item_instance = new item_path
|
|
var/initial_desc = initial(item_instance.desc)
|
|
|
|
if (item_instance.desc != initial_desc)
|
|
Fail("[orderable_item] has an item ([item_path]) that has a dynamic description. [item_instance.desc] (dynamic description) != [initial_desc] (initial description)")
|