Source.getCurrentSource is implemented in such a way that it calls getItemList, but ends up getting only the first Item in the list. This ends up being incredibly inefficient and slow once a source gets linked over several scenes, because lots of searchVideoItem and XML parsing is done for every single linked item.
As a proposed solution, we can potentially just extract the internal itemlist property directly and short-circuit this to get the first video item, in order to get the Source instance (Item#getSource).
(Just noting here that in a future refactor where Source and Item objects are barebones ids, it will be possible to directly get srcid and wrap that in a Source object instead. No need to go through Item#getSource so we can properly parse the presetconfig in order to construct the Source instance.)
Source.getCurrentSource
is implemented in such a way that it callsgetItemList
, but ends up getting only the firstItem
in the list. This ends up being incredibly inefficient and slow once a source gets linked over several scenes, because lots ofsearchVideoItem
and XML parsing is done for every single linked item.As a proposed solution, we can potentially just extract the internal
itemlist
property directly and short-circuit this to get the first video item, in order to get theSource
instance (Item#getSource
).(Just noting here that in a future refactor where
Source
andItem
objects are barebones ids, it will be possible to directly getsrcid
and wrap that in aSource
object instead. No need to go throughItem#getSource
so we can properly parse thepresetconfig
in order to construct theSource
instance.)