From c7d8b9b01c140a44abf2c93a4354ac0f66a68590 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 31 Jan 2020 15:52:20 +0100 Subject: QMakeProjectManager: Move some parsing code out of the UI thread When parsing larger qmake project, the callbacks from the parser threads are currently overloading the UI thread, often rendering the application non-responsive until the project is completely loaded. This patch moves some expensive operations from the UI thread into the parser threads, at the cost of a somewhat ugly two-stage setup for some types of objects. On my Linux machine, I measured that the time spent in parser callback code went down by almost 50% when loading the Qt Creator super project. Task-number: QTCREATORBUG-18533 Change-Id: If9624da5b07e81a50c180693580b20a70e1aaea7 Reviewed-by: hjk --- src/plugins/qmakeprojectmanager/qmakeparsernodes.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/plugins/qmakeprojectmanager/qmakeparsernodes.h') diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h index 61620e59fcf..9a5977348af 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h @@ -125,8 +125,10 @@ class QMAKEPROJECTMANAGER_EXPORT QmakePriFile { public: QmakePriFile(QmakeBuildSystem *buildSystem, QmakeProFile *qmakeProFile, const Utils::FilePath &filePath); + explicit QmakePriFile(const Utils::FilePath &filePath); virtual ~QmakePriFile(); + void finishInitialization(QmakeBuildSystem *buildSystem, QmakeProFile *qmakeProFile); Utils::FilePath filePath() const; Utils::FilePath directoryPath() const; virtual QString displayName() const; @@ -241,6 +243,7 @@ private: QMap m_files; QSet m_recursiveEnumerateFiles; // FIXME: Remove this?! QSet m_watchedFolders; + const Utils::FilePath m_filePath; bool m_includedInExactParse = true; friend class QmakeProFile; @@ -294,8 +297,11 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeProFile : public QmakePriFile { public: QmakeProFile(QmakeBuildSystem *buildSystem, const Utils::FilePath &filePath); + explicit QmakeProFile(const Utils::FilePath &filePath); ~QmakeProFile() override; + void setupFutureWatcher(); + bool isParent(QmakeProFile *node); QString displayName() const final; @@ -390,7 +396,7 @@ private: QMap m_wildcardDirectoryContents; // Async stuff - QFutureWatcher m_parseFutureWatcher; + QFutureWatcher *m_parseFutureWatcher = nullptr; QtSupport::ProFileReader *m_readerExact = nullptr; QtSupport::ProFileReader *m_readerCumulative = nullptr; }; -- cgit v1.2.3