perf: Micro-optimizations

This commit is contained in:
Chris Cameron
2018-07-20 16:41:44 -04:00
parent 6fb1e53776
commit 74c59bd7f3
5 changed files with 46 additions and 41 deletions

View File

@@ -232,8 +232,10 @@ namespace ICD.Common.Utils
CacheType(type);
return s_TypeToAttributesCache.ContainsKey(type)
? s_TypeToAttributesCache[type].ToArray()
IcdHashSet<Attribute> attributes;
return s_TypeToAttributesCache.TryGetValue(type, out attributes)
? attributes.ToArray(attributes.Count)
: Enumerable.Empty<Attribute>();
}