Skip to content

Improve RemoveDependenciesFromEntryIfMissing() when there is a lot of input files. #5180

@yuehuang010

Description

@yuehuang010

Steps to reproduce

Create a C++ Project with 300+ files. For simplicity, each file is a clones, named fromo file1.cpp to file file300.cpp. MSBuild project can use

#include <windows.h>
#include <__msvc_all_public_headers.hpp>
int somefunction() { return 0; }

msbuild.exe /t:ClCompile /p:UseMultiToolTask=true

I added some telemetry:
PostExecuteTool Part 1: 414ms
PostExecuteTool Part 2: 493ms
PostExecuteTool Part 2.1: 531ms
PostExecuteTool Part 2.2: 4800ms<!-- Jump here is only calling RemoveDependenciesFromEntryIfMissing()
PostExecuteTool Part 3: 4967ms
PostExecuteTool Total: 5019ms

Expected behavior

RemoveDependenciesFromEntryIfMissing() should take less time. 100ms or less.

Actual behavior

RemoveDependenciesFromEntryIfMissing() is took 4 seconds.

Notes:

CanonicalTrackedInputFiles.RemoveDependenciesFromEntryIfMissing() has a N^2 loop that is calling FileExists(). Adding a simple cache would speed up this process timing a lot.

OS info:
Windows 10, running under VS developer command prompt.

Metadata

Metadata

Assignees

Labels

Area: C++ tasks and targetsRelated to C++ (vcxproj) builds, which are part of Visual Studio and not part of this repository.Area: FileTrackerIssues with FileTracker, tracker.exe, and other Detours-based tracking implementations.Area: PerformancePartner requesttriaged

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions