Use more efficient search in MergeIntoResolved
Switch Enumerable.FirstOrDefault to List.Find. The latter can avoid some allocations because the concrete collection type is known.
This commit is contained in:
@@ -338,7 +338,7 @@ namespace OpenRA
|
|||||||
static void MergeIntoResolved(MiniYamlNode overrideNode, List<MiniYamlNode> existingNodes,
|
static void MergeIntoResolved(MiniYamlNode overrideNode, List<MiniYamlNode> existingNodes,
|
||||||
Dictionary<string, MiniYaml> tree, Dictionary<string, MiniYamlNode.SourceLocation> inherited)
|
Dictionary<string, MiniYaml> tree, Dictionary<string, MiniYamlNode.SourceLocation> inherited)
|
||||||
{
|
{
|
||||||
var existingNode = existingNodes.FirstOrDefault(n => n.Key == overrideNode.Key);
|
var existingNode = existingNodes.Find(n => n.Key == overrideNode.Key);
|
||||||
if (existingNode != null)
|
if (existingNode != null)
|
||||||
{
|
{
|
||||||
existingNode.Value = MergePartial(existingNode.Value, overrideNode.Value);
|
existingNode.Value = MergePartial(existingNode.Value, overrideNode.Value);
|
||||||
|
|||||||
Reference in New Issue
Block a user