mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-10 00:43:14 +00:00
* Adds an additional queue to the qdel subsystem to quickly filter out things that garbage collect within the first second. (#62969) Before, all items deleted would sit in a queue for 5 minutes, with all shrinks and expansions of said queue requiring byond to copy all of these items over to the new list. Theory: 99% of items soft-delete within byond within the first second. (5 minutes is only needed because a byond quirk with items referenced by verbs) Result: Within the first 7 minutes of a local test launch and round start, ~35,000 things get qdeleted. Of those 35 THOUSAND things, only 12 things failed as still referenced with a 1 second pre-queue. Said 12 things passed as garbage collected at the 5 minute queue. (Note: 30 thousand of these items are from world start and round init.) I have no data on how much this speeds anything up, leaving a 30 thousand list (that has to be copyed every time qdelete processes it and cuts off the items it processed) hanging around for no reason for the first 5 minutes of the round was all i needed to justify the pr. * Adds an additional queue to the qdel subsystem to quickly filter out things that garbage collect within the first second. Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
57 lines
3.1 KiB
Plaintext
57 lines
3.1 KiB
Plaintext
//! Defines that give qdel hints.
|
|
//!
|
|
//! These can be given as a return in [/atom/proc/Destroy] or by calling [/proc/qdel].
|
|
|
|
/// `qdel` should queue the object for deletion.
|
|
#define QDEL_HINT_QUEUE 0
|
|
/// `qdel` should let the object live after calling [/atom/proc/Destroy].
|
|
#define QDEL_HINT_LETMELIVE 1
|
|
/// Functionally the same as the above. `qdel` should assume the object will gc on its own, and not check it.
|
|
#define QDEL_HINT_IWILLGC 2
|
|
/// Qdel should assume this object won't GC, and queue a hard delete using a hard reference.
|
|
#define QDEL_HINT_HARDDEL 3
|
|
// Qdel should assume this object won't gc, and hard delete it posthaste.
|
|
#define QDEL_HINT_HARDDEL_NOW 4
|
|
|
|
|
|
#ifdef REFERENCE_TRACKING
|
|
/** If REFERENCE_TRACKING is enabled, qdel will call this object's find_references() verb.
|
|
*
|
|
* Functionally identical to [QDEL_HINT_QUEUE] if [GC_FAILURE_HARD_LOOKUP] is not enabled in _compiler_options.dm.
|
|
*/
|
|
#define QDEL_HINT_FINDREFERENCE 5
|
|
/// Behavior as [QDEL_HINT_FINDREFERENCE], but only if the GC fails and a hard delete is forced.
|
|
#define QDEL_HINT_IFFAIL_FINDREFERENCE 6
|
|
#endif
|
|
|
|
// Defines for the ssgarbage queues
|
|
#define GC_QUEUE_FILTER 1 //! short queue to filter out quick gc successes so they don't hang around in the main queue for 5 minutes
|
|
#define GC_QUEUE_CHECK 2 //! main queue that waits 5 minutes because thats the longest byond can hold a reference to our shit.
|
|
#define GC_QUEUE_HARDDELETE 3 //! short queue for things that hard delete instead of going thru the gc subsystem, this is purely so if they *can* softdelete, they will soft delete rather then wasting time with a hard delete.
|
|
#define GC_QUEUE_COUNT 3 //! Number of queues, used for allocating the nested lists. Don't forget to increase this if you add a new queue stage
|
|
|
|
// Defines for the time an item has to get its reference cleaned before it fails the queue and moves to the next.
|
|
#define GC_FILTER_QUEUE 1 SECONDS
|
|
#define GC_CHECK_QUEUE 5 MINUTES
|
|
#define GC_DEL_QUEUE 10 SECONDS
|
|
|
|
|
|
#define QDEL_ITEM_ADMINS_WARNED (1<<0) //! Set when admins are told about lag causing qdels in this type.
|
|
#define QDEL_ITEM_SUSPENDED_FOR_LAG (1<<1) //! Set when a type can no longer be hard deleted on failure because of lag it causes while this happens.
|
|
|
|
// Defines for the [gc_destroyed][/datum/var/gc_destroyed] var.
|
|
#define GC_QUEUED_FOR_QUEUING -1
|
|
#define GC_CURRENTLY_BEING_QDELETED -2
|
|
|
|
#define QDELING(X) (X.gc_destroyed)
|
|
#define QDELETED(X) (!X || QDELING(X))
|
|
#define QDESTROYING(X) (!X || X.gc_destroyed == GC_CURRENTLY_BEING_QDELETED)
|
|
|
|
#define QDEL_IN(item, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, (time) > GC_FILTER_QUEUE ? WEAKREF(item) : item), time, TIMER_STOPPABLE)
|
|
#define QDEL_IN_CLIENT_TIME(item, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, item), time, TIMER_STOPPABLE | TIMER_CLIENT_TIME)
|
|
#define QDEL_NULL(item) qdel(item); item = null
|
|
#define QDEL_LIST(L) if(L) { for(var/I in L) qdel(I); L.Cut(); }
|
|
#define QDEL_LIST_IN(L, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/______qdel_list_wrapper, L), time, TIMER_STOPPABLE)
|
|
#define QDEL_LIST_ASSOC(L) if(L) { for(var/I in L) { qdel(L[I]); qdel(I); } L.Cut(); }
|
|
#define QDEL_LIST_ASSOC_VAL(L) if(L) { for(var/I in L) qdel(L[I]); L.Cut(); }
|