aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2017-01-06 16:51:23 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2017-01-09 11:08:40 +0000
commit12d6dfe3f9e0f9ad5b9db488e5d2e7399132173b (patch)
treedf4a88429d7bb5261cdafd037e3b87e89218e50c
parentdd04f89de803f10201c2f5870ffff95d8452ee1c (diff)
Use of parallelism for Q_OBJECT parsing during .pro file import
First step to speed up the import of Qt projects from .pro files. Execute parsing for Q_OBJECT, Q_GADET macros in parallel and move it to a background task to not block the UI. This gains us close to 50% on a capable machine in combination with the former patch. Change-Id: Icb8acb1a633833dc490e94e3c9609894d30a7d4b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/qtprojectlib/QtProject.cs27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/qtprojectlib/QtProject.cs b/src/qtprojectlib/QtProject.cs
index 0ff7f916..78388c19 100644
--- a/src/qtprojectlib/QtProject.cs
+++ b/src/qtprojectlib/QtProject.cs
@@ -29,10 +29,12 @@
using EnvDTE;
using Microsoft.VisualStudio.VCProjectEngine;
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
+using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
@@ -1763,15 +1765,22 @@ namespace QtProjectLib
public void RepairGeneratedFilesStructure()
{
DeleteGeneratedFiles();
- foreach (VCFile file in (IVCCollection) vcPro.Files) {
- if (!HelperFunctions.IsHeaderFile(file.Name)
- && !HelperFunctions.IsSourceFile(file.Name)) {
- continue;
- }
- if (HelperFunctions.HasQObjectDeclaration(file)) {
- RemoveMocStep(file);
- AddMocStep(file);
- }
+
+ var files = new ConcurrentBag<VCFile>();
+ Task.Factory.StartNew(() =>
+ Parallel.ForEach(((IVCCollection) vcPro.Files).Cast<VCFile>(), file =>
+ {
+ var name = file.Name;
+ if (!HelperFunctions.IsHeaderFile(name) && !HelperFunctions.IsSourceFile(name))
+ return;
+ if (HelperFunctions.HasQObjectDeclaration(file))
+ files.Add(file);
+ })
+ );
+
+ foreach (var file in files) {
+ RemoveMocStep(file);
+ AddMocStep(file);
}
}