From 4007d546fbe491645d1807316a91af2b51ca8a1d Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Mon, 1 Jun 2020 10:13:21 -0700 Subject: [PATCH 01/10] Base bugfix --- .../TrackedDependencies/CanonicalTrackedInputFiles.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index a6281533708..8f162908100 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -49,6 +49,8 @@ public class CanonicalTrackedInputFiles private readonly HashSet _excludedInputPaths = new HashSet(StringComparer.Ordinal); // Cache of last write times private readonly ConcurrentDictionary _lastWriteTimeCache = new ConcurrentDictionary(StringComparer.Ordinal); + // + private HashSet fileCache = new HashSet(); #endregion #region Properties @@ -1071,9 +1073,11 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) if (keyIndex++ > 0) { // If we are ignoring missing files, then only record those that exist - if (FileUtilities.FileExistsNoThrow(file)) + // Cache the files as we find them to save time (On^2), at the expense of storing data O(n). + if (!fileCache.Contains(file) && FileUtilities.FileExistsNoThrow(file)) { dependenciesWithoutMissingFiles.Add(file, dependencies[file]); + fileCache.Add(file); } } else From edf163c252b159a30b0a2ade673f2f4a6703104a Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Tue, 2 Jun 2020 11:00:50 -0700 Subject: [PATCH 02/10] Apply same fix to OutputFiles --- .../TrackedDependencies/CanonicalTrackedInputFiles.cs | 2 +- .../TrackedDependencies/CanonicalTrackedOutputFiles.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 8f162908100..32a3b679c55 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -49,7 +49,7 @@ public class CanonicalTrackedInputFiles private readonly HashSet _excludedInputPaths = new HashSet(StringComparer.Ordinal); // Cache of last write times private readonly ConcurrentDictionary _lastWriteTimeCache = new ConcurrentDictionary(StringComparer.Ordinal); - // + // Cache of files that have been checked and exist. private HashSet fileCache = new HashSet(); #endregion diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index 5c906de1683..28ec4e16d9b 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -26,6 +26,8 @@ public class CanonicalTrackedOutputFiles private TaskLoggingHelper _log; // Are the tracking logs that we were constructed with actually available private bool _tlogAvailable; + // Cache of files that have been checked and exist. + private HashSet fileCache = new HashSet(); #endregion #region Properties @@ -768,9 +770,10 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) if (keyIndex++ > 0) { // If we are ignoring missing files, then only record those that exist - if (FileUtilities.FileExistsNoThrow(file)) + if (!fileCache.Contains(file) && FileUtilities.FileExistsNoThrow(file)) { dependenciesWithoutMissingFiles.Add(file, dependencies[file]); + fileCache.Add(file); } } else From 5c05c0f1d5bdeeb7ec644b66c300dd8eae52f150 Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Tue, 2 Jun 2020 14:13:24 -0700 Subject: [PATCH 03/10] Slightly modifying logic. We still want to run the same code on files we know exist, but we don't need to check for the file every time. --- .../TrackedDependencies/CanonicalTrackedInputFiles.cs | 8 ++++++-- .../TrackedDependencies/CanonicalTrackedOutputFiles.cs | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 32a3b679c55..1f4ea865dd0 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -1074,10 +1074,14 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) { // If we are ignoring missing files, then only record those that exist // Cache the files as we find them to save time (On^2), at the expense of storing data O(n). - if (!fileCache.Contains(file) && FileUtilities.FileExistsNoThrow(file)) + if (fileCache.Contains(file) || FileUtilities.FileExistsNoThrow(file)) { dependenciesWithoutMissingFiles.Add(file, dependencies[file]); - fileCache.Add(file); + + if (!fileCache.Contains(file)) + { + fileCache.Add(file); + } } } else diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index 28ec4e16d9b..4be389a2ec8 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -770,10 +770,14 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) if (keyIndex++ > 0) { // If we are ignoring missing files, then only record those that exist - if (!fileCache.Contains(file) && FileUtilities.FileExistsNoThrow(file)) + if (fileCache.Contains(file) || FileUtilities.FileExistsNoThrow(file)) { dependenciesWithoutMissingFiles.Add(file, dependencies[file]); - fileCache.Add(file); + + if(!fileCache.Contains(file)) + { + fileCache.Add(file); + } } } else From 0cf86a455be32e7af8ea5ef03b7263cee3a72133 Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Mon, 8 Jun 2020 14:13:23 -0700 Subject: [PATCH 04/10] Changed to dictionary To store whether a file that has been previously checked existed or not. That way we skip file checks on files that we already know don't exist. --- .../CanonicalTrackedInputFiles.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 1f4ea865dd0..5d44943ccd5 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -49,8 +49,8 @@ public class CanonicalTrackedInputFiles private readonly HashSet _excludedInputPaths = new HashSet(StringComparer.Ordinal); // Cache of last write times private readonly ConcurrentDictionary _lastWriteTimeCache = new ConcurrentDictionary(StringComparer.Ordinal); - // Cache of files that have been checked and exist. - private HashSet fileCache = new HashSet(); + // Cache of files that have been checked and whether or not they exist. + private Dictionary fileCache = new Dictionary(StringComparer.OrdinalIgnoreCase); #endregion #region Properties @@ -1072,16 +1072,20 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) { if (keyIndex++ > 0) { - // If we are ignoring missing files, then only record those that exist - // Cache the files as we find them to save time (On^2), at the expense of storing data O(n). - if (fileCache.Contains(file) || FileUtilities.FileExistsNoThrow(file)) + // Record whether or not each file exists and cache it. + // We do this to save time (On^2), at the expense of data O(n). + bool inFileCache = fileCache.ContainsKey(file); + + if(!inFileCache) { - dependenciesWithoutMissingFiles.Add(file, dependencies[file]); + fileCache.Add(file, FileUtilities.FileExistsNoThrow(file)); + } - if (!fileCache.Contains(file)) - { - fileCache.Add(file); - } + bool fileExists = fileCache[file]; + + if (fileExists) + { + dependenciesWithoutMissingFiles.Add(file, dependencies[file]); } } else From 309e8f6a5b20c6329b5fb6b43e993aee7a8062a2 Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Wed, 10 Jun 2020 09:09:01 -0700 Subject: [PATCH 05/10] Filecache now local to function Also slight changes to try to match code between canonicaltracked input and output files.cs --- .../CanonicalTrackedInputFiles.cs | 19 +++++---- .../CanonicalTrackedOutputFiles.cs | 42 +++++++++---------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 5d44943ccd5..1715c73b726 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -49,8 +49,6 @@ public class CanonicalTrackedInputFiles private readonly HashSet _excludedInputPaths = new HashSet(StringComparer.Ordinal); // Cache of last write times private readonly ConcurrentDictionary _lastWriteTimeCache = new ConcurrentDictionary(StringComparer.Ordinal); - // Cache of files that have been checked and whether or not they exist. - private Dictionary fileCache = new Dictionary(StringComparer.OrdinalIgnoreCase); #endregion #region Properties @@ -1035,6 +1033,9 @@ private void RemoveDependencyFromEntry(string rootingMarker, ITaskItem dependenc /// Outputs that correspond ot the sources (used for same file processing) public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] correspondingOutputs) { + // Cache of files that have been checked and exist. + Dictionary fileCache = new Dictionary(StringComparer.OrdinalIgnoreCase); + if (correspondingOutputs != null) { ErrorUtilities.VerifyThrowArgument(source.Length == correspondingOutputs.Length, "Tracking_SourcesAndCorrespondingOutputMismatch"); @@ -1043,7 +1044,7 @@ public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] // construct a combined root marker for the sources and outputs to remove from the graph string rootingMarker = FileTracker.FormatRootingMarker(source, correspondingOutputs); - RemoveDependenciesFromEntryIfMissing(rootingMarker); + RemoveDependenciesFromEntryIfMissing(rootingMarker, fileCache); // Remove entries for each individual source for (int sourceIndex = 0; sourceIndex < source.Length; sourceIndex++) @@ -1051,7 +1052,7 @@ public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] rootingMarker = correspondingOutputs != null ? FileTracker.FormatRootingMarker(source[sourceIndex], correspondingOutputs[sourceIndex]) : FileTracker.FormatRootingMarker(source[sourceIndex]); - RemoveDependenciesFromEntryIfMissing(rootingMarker); + RemoveDependenciesFromEntryIfMissing(rootingMarker, fileCache); } } @@ -1059,7 +1060,7 @@ public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] /// Remove the output graph entries for the given rooting marker /// /// - private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) + private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictionary fileCache) { // In the event of incomplete tracking information (i.e. this root was not present), just continue quietly // as the user could have killed the tool being tracked, or another error occurred during its execution. @@ -1076,14 +1077,14 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) // We do this to save time (On^2), at the expense of data O(n). bool inFileCache = fileCache.ContainsKey(file); - if(!inFileCache) + // Have we cached the file yet? If not, cache whether or not it exists. + if(!fileCache.ContainsKey(file)) { fileCache.Add(file, FileUtilities.FileExistsNoThrow(file)); } - bool fileExists = fileCache[file]; - - if (fileExists) + // Does the cached file exist? + if (fileCache[file]) { dependenciesWithoutMissingFiles.Add(file, dependencies[file]); } diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index 4be389a2ec8..45bc656276c 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -26,8 +26,6 @@ public class CanonicalTrackedOutputFiles private TaskLoggingHelper _log; // Are the tracking logs that we were constructed with actually available private bool _tlogAvailable; - // Cache of files that have been checked and exist. - private HashSet fileCache = new HashSet(); #endregion #region Properties @@ -726,6 +724,9 @@ private void RemoveDependencyFromEntry(string rootingMarker, ITaskItem dependenc /// Outputs that correspond ot the sources (used for same file processing) public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] correspondingOutputs) { + // Cache of files that have been checked and exist. + Dictionary fileCache = new Dictionary(StringComparer.OrdinalIgnoreCase); + if (correspondingOutputs != null) { ErrorUtilities.VerifyThrowArgument(source.Length == correspondingOutputs.Length, "Tracking_SourcesAndCorrespondingOutputMismatch"); @@ -734,21 +735,15 @@ public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] // construct a combined root marker for the sources and outputs to remove from the graph string rootingMarker = FileTracker.FormatRootingMarker(source, correspondingOutputs); - RemoveDependenciesFromEntryIfMissing(rootingMarker); + RemoveDependenciesFromEntryIfMissing(rootingMarker, fileCache); // Remove entries for each individual source for (int sourceIndex = 0; sourceIndex < source.Length; sourceIndex++) { - if (correspondingOutputs != null) - { - rootingMarker = FileTracker.FormatRootingMarker(source[sourceIndex], correspondingOutputs[sourceIndex]); - } - else - { - rootingMarker = FileTracker.FormatRootingMarker(source[sourceIndex]); - } - - RemoveDependenciesFromEntryIfMissing(rootingMarker); + rootingMarker = correspondingOutputs != null + ? FileTracker.FormatRootingMarker(source[sourceIndex], correspondingOutputs[sourceIndex]) + : FileTracker.FormatRootingMarker(source[sourceIndex]); + RemoveDependenciesFromEntryIfMissing(rootingMarker, fileCache); } } @@ -756,7 +751,7 @@ public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] /// Remove the output graph entries for the given rooting marker /// /// - private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) + private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictionary fileCache) { // In the event of incomplete tracking information (i.e. this root was not present), just continue quietly // as the user could have killed the tool being tracked, or another error occurred during its execution. @@ -769,15 +764,20 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker) { if (keyIndex++ > 0) { - // If we are ignoring missing files, then only record those that exist - if (fileCache.Contains(file) || FileUtilities.FileExistsNoThrow(file)) + // Record whether or not each file exists and cache it. + // We do this to save time (On^2), at the expense of data O(n). + bool inFileCache = fileCache.ContainsKey(file); + + // Have we cached the file yet? If not, cache whether or not it exists. + if (!fileCache.ContainsKey(file)) { - dependenciesWithoutMissingFiles.Add(file, dependencies[file]); + fileCache.Add(file, FileUtilities.FileExistsNoThrow(file)); + } - if(!fileCache.Contains(file)) - { - fileCache.Add(file); - } + // Does the cached file exist? + if (fileCache[file]) + { + dependenciesWithoutMissingFiles.Add(file, dependencies[file]); } } else From 8751c30d5696fbac1689bda78d09d4749bfd6485 Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Wed, 10 Jun 2020 11:55:31 -0700 Subject: [PATCH 06/10] Skip an extra dictonary lookup --- src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs | 2 +- .../TrackedDependencies/CanonicalTrackedOutputFiles.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 1715c73b726..622f677bb0f 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -1078,7 +1078,7 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona bool inFileCache = fileCache.ContainsKey(file); // Have we cached the file yet? If not, cache whether or not it exists. - if(!fileCache.ContainsKey(file)) + if(!inFileCache) { fileCache.Add(file, FileUtilities.FileExistsNoThrow(file)); } diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index 45bc656276c..37c31b49ca0 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -769,7 +769,7 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona bool inFileCache = fileCache.ContainsKey(file); // Have we cached the file yet? If not, cache whether or not it exists. - if (!fileCache.ContainsKey(file)) + if (!inFileCache) { fileCache.Add(file, FileUtilities.FileExistsNoThrow(file)); } From aad17bc6fb81918850cc3af84707d5b37ded47ec Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Wed, 10 Jun 2020 15:23:53 -0700 Subject: [PATCH 07/10] Reduce another dictionary lookup Responding to PR comments. --- .../TrackedDependencies/CanonicalTrackedInputFiles.cs | 4 ++-- .../TrackedDependencies/CanonicalTrackedOutputFiles.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 622f677bb0f..79c6abe6bd8 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -1075,7 +1075,7 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona { // Record whether or not each file exists and cache it. // We do this to save time (On^2), at the expense of data O(n). - bool inFileCache = fileCache.ContainsKey(file); + bool inFileCache = fileCache.TryGetValue(file, out bool fileExists); // Have we cached the file yet? If not, cache whether or not it exists. if(!inFileCache) @@ -1084,7 +1084,7 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona } // Does the cached file exist? - if (fileCache[file]) + if (fileExists) { dependenciesWithoutMissingFiles.Add(file, dependencies[file]); } diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index 37c31b49ca0..36c89b18cfb 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -766,7 +766,7 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona { // Record whether or not each file exists and cache it. // We do this to save time (On^2), at the expense of data O(n). - bool inFileCache = fileCache.ContainsKey(file); + bool inFileCache = fileCache.TryGetValue(file, out bool fileExists); // Have we cached the file yet? If not, cache whether or not it exists. if (!inFileCache) @@ -775,7 +775,7 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona } // Does the cached file exist? - if (fileCache[file]) + if (fileExists) { dependenciesWithoutMissingFiles.Add(file, dependencies[file]); } From 0e94024088754e7a1692da8b375e34da102a9e35 Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Thu, 11 Jun 2020 08:23:23 -0700 Subject: [PATCH 08/10] Responding to PR comments Correctly caching whether or not the file exists in the case that we hadn't already cached it. --- .../TrackedDependencies/CanonicalTrackedInputFiles.cs | 5 +++-- .../TrackedDependencies/CanonicalTrackedOutputFiles.cs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 79c6abe6bd8..367b405232f 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -1078,9 +1078,10 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona bool inFileCache = fileCache.TryGetValue(file, out bool fileExists); // Have we cached the file yet? If not, cache whether or not it exists. - if(!inFileCache) + if (!inFileCache) { - fileCache.Add(file, FileUtilities.FileExistsNoThrow(file)); + fileExists = FileUtilities.FileExistsNoThrow(file); + fileCache.Add(file, fileExists); } // Does the cached file exist? diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index 36c89b18cfb..2b3acfbd520 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -771,7 +771,8 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona // Have we cached the file yet? If not, cache whether or not it exists. if (!inFileCache) { - fileCache.Add(file, FileUtilities.FileExistsNoThrow(file)); + fileExists = FileUtilities.FileExistsNoThrow(file); + fileCache.Add(file, fileExists); } // Does the cached file exist? From 01517b54766e076829069a13669f7e43edca7966 Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Thu, 11 Jun 2020 08:51:04 -0700 Subject: [PATCH 09/10] Updated comments. --- .../TrackedDependencies/CanonicalTrackedOutputFiles.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index 2b3acfbd520..c57d4410bdb 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -724,7 +724,7 @@ private void RemoveDependencyFromEntry(string rootingMarker, ITaskItem dependenc /// Outputs that correspond ot the sources (used for same file processing) public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] correspondingOutputs) { - // Cache of files that have been checked and exist. + // Cache of files and whether or not they exist. Dictionary fileCache = new Dictionary(StringComparer.OrdinalIgnoreCase); if (correspondingOutputs != null) @@ -768,7 +768,7 @@ private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictiona // We do this to save time (On^2), at the expense of data O(n). bool inFileCache = fileCache.TryGetValue(file, out bool fileExists); - // Have we cached the file yet? If not, cache whether or not it exists. + // Have we cached the file yet? If not, cache its existence. if (!inFileCache) { fileExists = FileUtilities.FileExistsNoThrow(file); From bc4d9d9164f43208dd0eca1efa7d9e492333b204 Mon Sep 17 00:00:00 2001 From: Ben Villalobos Date: Thu, 11 Jun 2020 11:42:56 -0700 Subject: [PATCH 10/10] Documented new parameter. --- src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs | 1 + src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs index 367b405232f..be7d6f571f5 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedInputFiles.cs @@ -1060,6 +1060,7 @@ public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] /// Remove the output graph entries for the given rooting marker /// /// + /// The cache used to store whether each file exists or not. private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictionary fileCache) { // In the event of incomplete tracking information (i.e. this root was not present), just continue quietly diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index c57d4410bdb..7ca96f897c0 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -751,6 +751,7 @@ public void RemoveDependenciesFromEntryIfMissing(ITaskItem[] source, ITaskItem[] /// Remove the output graph entries for the given rooting marker /// /// + /// The cache used to store whether each file exists or not. private void RemoveDependenciesFromEntryIfMissing(string rootingMarker, Dictionary fileCache) { // In the event of incomplete tracking information (i.e. this root was not present), just continue quietly