mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-06 06:52:39 +00:00
* Adds lazyloading to the asset subsystems (#69454) * Adds lazyloading to the asset subsystems This currently applies only to spritesheets because of how monumentally expensive they are. If an asset is requested it will immediately be fully loaded, but otherwise we slowly load them in with a separate subsystem. This allows us to not hold up initialize with hair stuff. Saves roughly 33% (16 seconds with LOW_MEMORY_MODE) of initialize on my machine My target is something closer to the 9 second init that had back in 2019, this is a good first step. Lets see how much more we can do yeah lads? Co-authored-by: san7890 <the@ san7890.com> * Adds lazyloading to the asset subsystems Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: san7890 <the@ san7890.com>
25 lines
784 B
Plaintext
25 lines
784 B
Plaintext
/// Initializes any assets that need to be loaded ASAP.
|
|
/// This houses preference menu assets, since they can be loaded at any time,
|
|
/// most dangerously before the atoms SS initializes.
|
|
/// Thus, we want it to fail consistently in CI as if it would've if a player
|
|
/// opened it up early.
|
|
SUBSYSTEM_DEF(early_assets)
|
|
name = "Early Assets"
|
|
init_order = INIT_ORDER_EARLY_ASSETS
|
|
flags = SS_NO_FIRE
|
|
|
|
/datum/controller/subsystem/early_assets/Initialize(start_timeofday)
|
|
for (var/datum/asset/asset_type as anything in subtypesof(/datum/asset))
|
|
if (initial(asset_type._abstract) == asset_type)
|
|
continue
|
|
|
|
if (!initial(asset_type.early))
|
|
continue
|
|
|
|
if (!load_asset_datum(asset_type))
|
|
stack_trace("Could not initialize early asset [asset_type]!")
|
|
|
|
CHECK_TICK
|
|
|
|
return ..()
|