mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 22:19:30 +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:
@@ -23,7 +23,7 @@
|
||||
return ATAN2((b.y - a.y), (b.x - a.x))
|
||||
|
||||
/// For positions with map x/y/z and pixel x/y so you don't have to return lists. Could use addition/subtraction in the future I guess.
|
||||
/datum/position
|
||||
/datum/position
|
||||
var/x = 0
|
||||
var/y = 0
|
||||
var/z = 0
|
||||
@@ -68,7 +68,7 @@
|
||||
return new /datum/point(src)
|
||||
|
||||
/// A precise point on the map in absolute pixel locations based on world.icon_size. Pixels are FROM THE EDGE OF THE MAP!
|
||||
/datum/point
|
||||
/datum/point
|
||||
var/x = 0
|
||||
var/y = 0
|
||||
var/z = 0
|
||||
@@ -83,7 +83,7 @@
|
||||
return p
|
||||
|
||||
/// First argument can also be a /datum/position or /atom.
|
||||
/datum/point/New(_x, _y, _z, _pixel_x = 0, _pixel_y = 0)
|
||||
/datum/point/New(_x, _y, _z, _pixel_x = 0, _pixel_y = 0)
|
||||
if(istype(_x, /datum/position))
|
||||
var/datum/position/P = _x
|
||||
_x = P.x
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
/datum/point/proc/debug_out()
|
||||
var/turf/T = return_turf()
|
||||
return "\ref[src] aX [x] aY [y] aZ [z] pX [return_px()] pY [return_py()] mX [T.x] mY [T.y] mZ [T.z]"
|
||||
return "[text_ref(src)] aX [x] aY [y] aZ [z] pX [return_px()] pY [return_py()] mX [T.x] mY [T.y] mZ [T.z]"
|
||||
|
||||
/datum/point/proc/move_atom_to_src(atom/movable/AM)
|
||||
AM.forceMove(return_turf())
|
||||
@@ -134,11 +134,11 @@
|
||||
|
||||
/datum/point/vector
|
||||
/// Pixels per iteration
|
||||
var/speed = 32
|
||||
var/speed = 32
|
||||
var/iteration = 0
|
||||
var/angle = 0
|
||||
/// Calculated x movement amounts to prevent having to do trig every step.
|
||||
var/mpx = 0
|
||||
var/mpx = 0
|
||||
/// Calculated y movement amounts to prevent having to do trig every step.
|
||||
var/mpy = 0
|
||||
var/starting_x = 0 //just like before, pixels from EDGE of map! This is set in initialize_location().
|
||||
@@ -158,7 +158,7 @@
|
||||
starting_z = z
|
||||
|
||||
/// Same effect as initiliaze_location, but without setting the starting_x/y/z
|
||||
/datum/point/vector/proc/set_location(tile_x, tile_y, tile_z, p_x = 0, p_y = 0)
|
||||
/datum/point/vector/proc/set_location(tile_x, tile_y, tile_z, p_x = 0, p_y = 0)
|
||||
if(!isnull(tile_x))
|
||||
x = ((tile_x - 1) * world.icon_size) + world.icon_size * 0.5 + p_x + 1
|
||||
if(!isnull(tile_y))
|
||||
|
||||
Reference in New Issue
Block a user