Even with lazy asset loading, every preference still creates lots of icons in their init_possible_values() functions. init_possible_values(), of many preferences, returns both the asset name AND the icons.
Estimated Cost
/datum/asset/json/preferences/generate is 3.3s with CACHE_ASSETS on (not sure how much higher off). Of that 3.3s, 2.21s (67%) is hairstyle/compile_constant_data. 553ms is choiced/compile_constant_data generally, followed by 484ms of facial_hairstyle/compile_constant_data.
Solutions
init_possible_values() can be changed to only give text values, with icon generation being a separate proc. This would be accompanied by a unit test to make sure every value has an associated icon (if icons are applicable to the setting). This would, ideally, defer costs until the preferences menu is loaded when clicking setup character (since preference asset generation is lazy, even when uncached).
Even with lazy asset loading, every preference still creates lots of icons in their
init_possible_values()
functions.init_possible_values()
, of many preferences, returns both the asset name AND the icons.Estimated Cost
/datum/asset/json/preferences/generate
is 3.3s with CACHE_ASSETS on (not sure how much higher off). Of that 3.3s, 2.21s (67%) is hairstyle/compile_constant_data. 553ms is choiced/compile_constant_data generally, followed by 484ms of facial_hairstyle/compile_constant_data.Solutions
init_possible_values()
can be changed to only give text values, with icon generation being a separate proc. This would be accompanied by a unit test to make sure every value has an associated icon (if icons are applicable to the setting). This would, ideally, defer costs until the preferences menu is loaded when clicking setup character (since preference asset generation is lazy, even when uncached).