@meiroo2 i'm not sure I understand your question correctly. Are you asking whether it helps performance to create a dictionary over all entries of SkeletonData.Skins
and access the dictionary instead of letting SkeletonData.FindSkin()
iterate over the list of entries and perform the string comparison at the elements? If so, then theoretically this will save some string comparison operations. I doubt that this will be a measurable improvement though.
In general, linear O(n) search in an array or list datastructure will be faster than O(1) search in "optimized" tree like structures until the size grows to very large numbers, due to cache locality. Given that Dictionary<>
should be implemented as a HashMap
, it should not be too bad regarding cache locality though, so it might be worth a shot if you really have a lot of skins in your skeletons and spend measurable time in FindSkin()
. Then be sure to measure both alternatives, and check if you see any difference at all (best on the target device).