[Development] Qt Compilation Speed
Thiago Macieira
thiago.macieira at intel.com
Mon Jan 3 15:18:16 CET 2022
On Monday, 3 January 2022 11:05:25 -03 Philippe wrote:
> > The change to C++17 makes a huge difference too, regardless of PCH. That
> > #include <algorithm> in qglobal.h adds up to 300 ms in each build without
> > PCH, and a considerable amount with it too. And it gets worse with C++20
> > and ranges.
> I did not notice any sensitive change when switching to C++20 (but not
> using ranges).
I noticed that with GCC. It's easy to make a simple test to check how long it
takes to compile single C++ source file with #include <algorithm>, with the
C++ standards from 98 to 20.
Just preprocessing:
/bin/g++ -E -std=c++98 -xc++ -include algorithm -
0.012948 +- 0.000511 seconds time elapsed ( +- 3.95% )
/bin/g++ -E -std=c++11 -xc++ -include algorithm -
0.013293 +- 0.000261 seconds time elapsed ( +- 1.96% )
/bin/g++ -E -std=c++14 -xc++ -include algorithm -
0.013759 +- 0.000295 seconds time elapsed ( +- 2.14% )
/bin/g++ -E -std=c++17 -xc++ -include algorithm -
0.020926 +- 0.000143 seconds time elapsed ( +- 0.68% )
/bin/g++ -E -std=c++20 -xc++ -include algorithm -
0.03537 +- 0.00158 seconds time elapsed ( +- 4.45% )
Preprocessing and compiling:
/bin/g++ -c -std=c++98 -xc++ -include algorithm -o /dev/null -
0.027671 +- 0.000223 seconds time elapsed ( +- 0.81% )
/bin/g++ -c -std=c++11 -xc++ -include algorithm -o /dev/null -
0.040294 +- 0.000378 seconds time elapsed ( +- 0.94% )
/bin/g++ -c -std=c++14 -xc++ -include algorithm -o /dev/null -
0.04268 +- 0.00119 seconds time elapsed ( +- 2.78% )
/bin/g++ -c -std=c++17 -xc++ -include algorithm -o /dev/null -
0.12293 +- 0.00157 seconds time elapsed ( +- 1.27% )
/bin/g++ -c -std=c++20 -xc++ -include algorithm -o /dev/null -
0.29412 +- 0.00682 seconds time elapsed ( +- 2.32% )
Repeating the experiment with precompiled headers is left as an exercise to
the reader.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel DPG Cloud Engineering
More information about the Development
mailing list