[Qt-creator] Compiling Qt Creator in under 3 minutes

Jussi Pakkanen jpakkane at gmail.com
Tue May 20 23:36:42 CEST 2014


This is a bit of a followup on my previous post with Clang static analyzer.
After I wrote QtCreator's build system in Meson I wanted to test how fast
QtCreator could be built from scratch using Meson's automatic unity build
generator. The answer turned out to be really fast (caveats below).

Non-optimized builds

Regular: 26m 52s
Unity: 2m 26s

Optimized builds

Regular: 32m 4s
Unity: 6m 22s

All these times are done with a new MBP with an SSD and 16GB of memory. As
can be seen, doing a unity build is over 90% faster in the non-optimized
case. Unfortunately I don't have comparison times for QMake as this
particular checkout does not compile for me for some reason.

If you want to do the comparison yourself, you can find the gitorious link
for the regular build in the previous email. Gitorious broke down so I
could not upload the unity branch, but you can get the git directory here:
https://dl.dropboxusercontent.com/u/37517477/qtc-unity-gitdir.tar.xz. In
order to get a unity build, you need to pass the --unity flag to Meson
during configuration time.

Issues noted

In theory unity builds should not require any code changes. In practice
they almost always do. I ran into all sorts of issues and fixed them in the
simplest possible way (sometimes just commenting out code or entire files).
The unity builds thus do slightly less work, but I'd estimate it's around
1%. These are some of the things that broke:

- static variables/functions in two files with the same name (uncovered
full copypasted functions)
- namespace collisions caused by using statements
- namespace clashes in code generated by uic, as it refers to its own stuff
with namespace Ui instead of ::Ui

Hack/slashing all these issues took a few evenings. A proper fix would
probably take several days. Some of the fixes (such as flushing out
duplicate code) would be generally useful.

This was an interesting experiment to do, I hope you enjoyed it as well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140521/2b3da828/attachment.html>

More information about the Qt-creator mailing list