Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorIan Toal <iantoal@microsoft.com>2019-12-11 00:19:33 +0300
committerGitHub <noreply@github.com>2019-12-11 00:19:33 +0300
commit7511f1cb15853a82b544ea40164b2e2f59f51db7 (patch)
tree81d57c45fcdcfd146c6bac072411b414f6fcdda4 /main/src
parent2055eace84f84acc462167b82f205cb4326aab65 (diff)
Improve FileNesting performance by avoiding costly IO (#9451)
Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1034938 Given the current FileNesting logic, we check for a potential parent which matches a filepath spec. We filter out these parents if they are directories using FilePath.IsDirectory, which causes IO via Directory.Exists. As we already know whether a filepath in the project filelist is a directory, we should delay this filtering and avoid the IO. Testing: This change has a 2x speedup (~2.5mins to ~1.1min) for a React.js & Redux Asp.Net Core project which has a node_modules folder added to the project.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/NestingRule.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/NestingRule.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/NestingRule.cs
index c3c633cb5b..d7f29dc253 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/NestingRule.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/NestingRule.cs
@@ -63,9 +63,9 @@ namespace MonoDevelop.Ide.Projects.FileNesting
ProjectFile CheckParentForFile (ProjectFile inputFile, FilePath parentFile, FilePath inDirectory)
{
- if (inputFile.FilePath != parentFile && !parentFile.IsDirectory && inDirectory == parentFile.ParentDirectory) {
+ if (inputFile.FilePath != parentFile && inDirectory == parentFile.ParentDirectory) {
var parent = inputFile.Project.Files.GetFile (parentFile);
- if (parent != null) {
+ if (parent != null && parent.Subtype != Subtype.Directory) {
Debug.WriteLine ($"Applied rule for nesting {inputFile} under {parentFile}");
return parent;
}