diff options
author | Nikolai Kosjar <[email protected]> | 2017-02-06 16:59:53 +0100 |
---|---|---|
committer | Nikolai Kosjar <[email protected]> | 2017-02-20 09:18:13 +0000 |
commit | 8c90998fff6ec3cf85ad87b56175e86b6f0a93d0 (patch) | |
tree | c3f838d24e4cd7c3484c5a50d1f07a5b73de5bf9 /src/plugins/cmakeprojectmanager/tealeafreader.h | |
parent | 010060de5c205a79dba0343ef82f10f3446c1e58 (diff) |
CppTools/ProjectManagers: Reduce ui blocking when loading projects
${AnyProject}::updateCppCodeModel() did two potentially not that cheap
operations in the ui thread:
(1) Querying the MimeDatabase for the mime type for the source files of
the project. In 99.9% of the cases no files need to be read for
this as the file extension will resolve the type. The expensiveness
comes from the sheer number of files that can occur.
(2) Calling compilers with the "(sub)project's compiler command line"
to determine the macros. While the caches avoid redundant calls,
the number of the unique compiler calls makes this still a
ui-freezing experience.
These two operations are moved into a worker thread. For this, the
expensive compiler calls are encapsulated in thread safe lambdas
("runners") in order to keep the "mutexed" data minimal. The original
API calls of the toolchains are implemented in terms of the runners.
While adapting the project managers, remove also the calls to
setProjectLanguage(). These are redundant because all of the project
managers already set a proper value in the constructor. Also, currently
there is no need (client) to report back detection of C sources in
project parts. This also keeps CppProjectUpdater simple.
There is still room for improvement:
* Run the compiler calls in parallel instead of sequence.
* Ensure that the mime type for a file is determined exactly once.
Change-Id: I2efc4e132ee88e3c8f264012ec8fafe3d86c404f
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/tealeafreader.h')
-rw-r--r-- | src/plugins/cmakeprojectmanager/tealeafreader.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/cmakeprojectmanager/tealeafreader.h b/src/plugins/cmakeprojectmanager/tealeafreader.h index 4eca9b0af83..3aa258580a5 100644 --- a/src/plugins/cmakeprojectmanager/tealeafreader.h +++ b/src/plugins/cmakeprojectmanager/tealeafreader.h @@ -58,7 +58,7 @@ public: CMakeConfig takeParsedConfiguration() final; void generateProjectTree(CMakeListsNode *root, const QList<const ProjectExplorer::FileNode *> &allFiles) final; - QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder) final; + void updateCodeModel(CppTools::RawProjectParts &rpps) final; private: void cleanUpProcess(); |