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

Jussi Pakkanen jpakkane at gmail.com
Wed May 21 21:28:50 CEST 2014

On Wed, May 21, 2014 at 10:10 PM, André Pönitz <apoenitz at t-online.de> wrote:

> I am not sure I understood what the unity build does. Closest I can imagine
> is that it concatenates some (or all?) translation units into one and tries
> to compile the result. Of course that would not work with normal C++
> projects
> but would impose rather harsh restriction on naming conventions and code
> structure, so this can't be what is meant as this interpretation conflicts
> with the "in theory unity builds should not require any code changes".

There is a more involved explanation in Meson wiki:


The tl/dr version is that your description is exactly correct. Meson's
unity build generator does roughly this for each target (shared library,
executable, etc):

cat *.cpp > target-unity.cpp

You are right in that this may cause clashes, some of them are discussed in
my original mail. But it turns out that if you are already following good
practices on code organisation, the amount of changes you need to do is not
that big and some of them are beneficial in and of themselves, such as
removing copypasted static functions. (And if you are not following good
practices, you probably have bigger problems. ;-) I have worked on code
bases of moderate size that required zero changes to compile as a unity
build, even though they were not originally designed for it. There is
usually some extra effort in supporting unity builds, so whether you should
do it depends on your code base and requirements.

Since my previous post got onto Phoronix, let me add a few clarifications

- the measurements were done with Gcc, I'd like to measure Clang times too
but unfortunately my utopic install just broke and became unbootable
- the CPU was a 2.4 GHz i5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140521/20d25cfc/attachment.html>

More information about the Qt-creator mailing list