[Qbs] Qbs (way) faster than cmake (or benchmark issue)

Christian Gagneraud chgans at gmail.com
Tue Jul 16 08:29:35 CEST 2019


Hi there,

I finally found time to start my qbs vs cmake build perf.

What i found is that qbs beats cmake 'big time' on my build machine
and i was actually surprised, so surprised that i'm trying to find
where is the mistake.

Basically, qbs builds more stuff than cmake in less time (!?!)

Build server:
- Dual Xeon Gold 6132
- 256GB RAM
- 2TB RAID-something SSD

Total cores: 28, total threads: 56

$ time qbs -f ../qtcreator.qbs profile:qt-5-12-2
real    3m6.159s
user    96m51.927s
sys     19m52.059s
$ du -sh
18G     .
$ find . -name '*.o' | wc -l
4917
$ find default/install-root/ -name '*.so' | wc -l
93

$ time cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG="-O0 -g"
-G Ninja ..
real    0m3.281s
user    0m1.960s
sys     0m1.327s
$ time ninja
real    4m51.174s
user    70m58.028s
sys     23m9.238s
$ du -sh
4.9G    .
$ find . -name '*.o' | wc -l
2881
$ find . -name '*.so' | wc -l
88

The compiler flags are not the same, but not so far off:
Qbs: -g -O0 -Wall -Wextra -m64 -pipe -fexceptions -fvisibility=hidden
-fvisibility-inlines-hidden -fPIC
CMake: -g -O0 -std=c++14 -fvisibility=hidden
-fvisibility-inlines-hidden -fPIC -fstack-protector-strong -Wformat
-Wformat-security

Qbs wall time: 3m6
CMake wall time:  4m54
Qbs CPU time = 97 + 20 = 107 minutes
CMake CPU time = 71 + 23 = 94 minutes

While it was building, htop showed that Qbs made a better CPU usage
than CMake. Qbs tend to load all the CPU at maximum for almost the
entire duration of the build while Cmake had lot of gaps in term of
CPU usage.

As well, somehow qbs did more stuff, since it populated the
install-root, where-as cmake has a sort of "in-place" install-root
(build dir is install-root)


If i have more time, i would like to explore:
- https://lists.qt-project.org/pipermail/qbs/2019-May/002408.html
- https://lists.qt-project.org/pipermail/qbs/2019-May/002419.html
- make a graph with build time vs job counts
- add cold/warm ccache
- use RAM disk for ccache store and build directory

I did a similar benchmark for our project, it showed that our build
system (qmake) was unable to cope with more than 6 cores, enabling dep
tracking improved the situation but was still not scalable. CMake
(+Ninja) is better than qmake, but i  never ran a comparison with Qbs.

Chris


More information about the Qbs mailing list