From 47742270cbf8bc51864658484a7fdc378f6f53a9 Mon Sep 17 00:00:00 2001 From: therzok Date: Tue, 18 Jun 2019 03:22:42 +0300 Subject: Initial work towards optimizing FileService handlers Fixes VSTS #853896 - [Feedback] Visual Studio freezes when i run mono Fixes VSTS #902435 - Investigate performance issue with FileSystemWatcher --- .../MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs | 5 ++++- .../MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild') diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs index 0cc36a1f0e..49f790ef94 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs @@ -1435,7 +1435,10 @@ namespace MonoDevelop.Projects.MSBuild { var pi = (ProjectInfo)projectInstance; string filePath = MSBuildProjectService.FromMSBuildPath (pi.Project.BaseDirectory, include); - foreach (var g in pi.GlobIncludes.Where (g => g.Condition)) { + foreach (var g in pi.GlobIncludes) { + if (!g.Condition) + continue; + if (g.ExcludeRegex != null) { if (g.ExcludeRegex.IsMatch (include)) continue; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs index d2874912c7..703bbcf97d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs @@ -843,7 +843,7 @@ namespace MonoDevelop.Projects.MSBuild { int i = str.IndexOfAny (specialCharacters); if (i != -1) { - var sb = new System.Text.StringBuilder (); + var sb = StringBuilderCache.Allocate (); int start = 0; while (i != -1) { sb.Append (str, start, i - start); @@ -855,7 +855,7 @@ namespace MonoDevelop.Projects.MSBuild } if (start < str.Length) sb.Append (str, start, str.Length - start); - return sb.ToString (); + return StringBuilderCache.ReturnAndFree (sb); } return str; } -- cgit v1.2.3