From 87e3de72a27067930c7ce6e9130ba6da00eebf78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Pelletier?= Date: Fri, 8 Nov 2024 16:45:30 -0500 Subject: [PATCH] Optimized Solution.GetResolvedProjects() - Changed a List to a HashSet - using TryGet instead of ContainsKey followed by an indexer get(eliminates half of dictionary access) - Using HashSet.Add instead a List.Contains followed by a Add Before: 33 secs over 24 threads After: 13.9 secs over 24 threads Gain: ~.5 secs wall clock when generating projects for anvil pipeline --- Sharpmake/Solution.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Sharpmake/Solution.cs b/Sharpmake/Solution.cs index dedfc2a88..c627825db 100644 --- a/Sharpmake/Solution.cs +++ b/Sharpmake/Solution.cs @@ -117,7 +117,7 @@ public class ResolvedProject public string ProjectFile; // Resolved Project dependencies - public List Dependencies = new List(); + public HashSet Dependencies = new HashSet(); // User data, may be use by generator to attach user data public Dictionary UserData = new Dictionary(); @@ -191,8 +191,7 @@ public IEnumerable GetResolvedProjects(IEnumerable GetResolvedProjects(IEnumerable