Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/use cpp samples #1

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.sconsign.dblite
CMakeLists.txt
SConstruct
generated/
build*/
compile_commands.json
meson-info/
Expand Down
133 changes: 73 additions & 60 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,100 +13,113 @@ This bring into focus the performance of the buildsystem.

Setup test suite::

clausklein$ ./gen_src.py build
generate 2 directories containing each 4 source files
clausklein$ ./gen_src.py --outdir=generated
generate 9 directories containing each 7 source files
clausklein$

Run test suite::

clausklein$ ./measure.py build
Running command: rm -rf build-cmake && mkdir -p build-cmake && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -B build-cmake
clausklein$ ./measure.py generated
Running command: rm -rf build-cmake && mkdir -p build-cmake && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -B build-cmake
Running command: make -C build-cmake -j 4
Running command: make -C build-cmake -j 4
Running command: make -C build-cmake -j 4 clean
Running command: make -C build-cmake -j 4
Running command: rm -rf build-cmake-ninja && mkdir -p build-cmake-ninja && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -B build-cmake-ninja -G Ninja
Running command: rm -rf build-cmake-ninja && mkdir -p build-cmake-ninja && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -B build-cmake-ninja -G Ninja
Running command: ninja -C build-cmake-ninja -j 4
Running command: ninja -C build-cmake-ninja -j 4
Running command: ninja -C build-cmake-ninja -j 4 clean
Running command: ninja -C build-cmake-ninja -j 4
Running command: rm -rf build-meson && mkdir -p build-meson && CC='ccache gcc' meson build-meson
Running command: rm -rf build-meson && mkdir -p build-meson && CC='ccache g++' meson build-meson
Running command: ninja -C build-meson -j 4
Running command: ninja -C build-meson -j 4
Running command: ninja -C build-meson -j 4 clean
Running command: ninja -C build-meson -j 4
cmake-make
0.865 gen
0.518 build
0.189 empty build
0.095 clean
0.566 rebuild
2.234 overall
0.401 gen
0.803 build
0.200 empty build
0.076 clean
0.797 rebuild
2.275 overall
cmake-ninja
0.718 gen
0.188 build
0.013 empty build
0.032 clean
0.204 rebuild
1.155 overall
0.609 gen
0.468 build
0.058 empty build
0.120 clean
0.456 rebuild
1.712 overall
meson
1.611 gen
0.237 build
0.013 empty build
0.022 clean
0.219 rebuild
2.101 overall
1.163 gen
0.506 build
0.058 empty build
0.124 clean
0.503 rebuild
2.353 overall
clausklein$


The ninja based builds are the best as expected
-----------------------------------------------

One interesting point is the different size of the generated ninja build files.
The meson build generator creates only one and a simpler and clear
The *meson* build generator creates only one and a simpler and clear
**build.ninja** file::

clausklein$ find build -name '*.ninja' -ls
81941300 48 -rw-r--r-- 1 clausklein staff 21306 8 Feb 10:17 build/buildcmakeninja/build.ninja
81941301 8 -rw-r--r-- 1 clausklein staff 2681 8 Feb 10:17 build/buildcmakeninja/rules.ninja
81941494 16 -rw-r--r-- 1 clausklein staff 5686 8 Feb 10:17 build/buildmeson/build.ninja
clausklein$ find generated -name '*.ninja' -ls
38100869 72 -rw-r--r-- 1 clausklein staff 34404 16 Okt 22:14 generated/build-meson/build.ninja
38100178 24 -rw-r--r-- 1 clausklein staff 10302 16 Okt 22:14 generated/build-cmake-ninja/CMakeFiles/rules.ninja
38100177 184 -rw-r--r-- 1 clausklein staff 91983 16 Okt 22:14 generated/build-cmake-ninja/build.ninja
clausklein$


And build performance with a real project
------------------------------------------

The https://github.com/open-source-parsers/jsoncpp use both, *meson* and *cmake*::

bash-5.0$ python3 ./build_performance_measure.py
Running command: rm -rf build-cmake-ninja && mkdir -p build-cmake-ninja && CXX=g++ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release -G Ninja -B build-cmake-ninja
Running command: ninja -C build-cmake-ninja
Running command: ninja -C build-cmake-ninja
Running command: ninja -C build-cmake-ninja clean
Running command: ninja -C build-cmake-ninja
Running command: rm -rf build-meson && mkdir -p build-meson && CXX='ccache g++' meson build-meson
Running command: ninja -C build-meson
Running command: ninja -C build-meson
Running command: ninja -C build-meson clean
Running command: ninja -C build-meson
The https://github.com/open-source-parsers/jsoncpp supports both, *meson* and *cmake*::

clausklein$ ~/cmake/BuildPerformance/measure.py .
Running command: rm -rf build-cmake && mkdir -p build-cmake && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -B build-cmake
Running command: make -C build-cmake -j 4
Running command: make -C build-cmake -j 4
Running command: make -C build-cmake -j 4 clean
Running command: make -C build-cmake -j 4
Running command: rm -rf build-cmake-ninja && mkdir -p build-cmake-ninja && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -B build-cmake-ninja -G Ninja
Running command: ninja -C build-cmake-ninja -j 4
Running command: ninja -C build-cmake-ninja -j 4
Running command: ninja -C build-cmake-ninja -j 4 clean
Running command: ninja -C build-cmake-ninja -j 4
Running command: rm -rf build-meson && mkdir -p build-meson && CC='ccache g++' meson build-meson
Running command: ninja -C build-meson -j 4
Running command: ninja -C build-meson -j 4
Running command: ninja -C build-meson -j 4 clean
Running command: ninja -C build-meson -j 4
cmake-make
1.704 gen
0.858 build
0.119 empty build
0.116 clean
0.706 rebuild
3.503 overall
cmake-ninja
3.755 gen
0.739 build
0.018 empty build
0.044 clean
0.721 rebuild
5.276 overall
2.945 gen
0.558 build
0.058 empty build
0.106 clean
0.391 rebuild
4.057 overall
meson
1.918 gen
1.409 build
0.014 empty build
0.032 clean
1.410 rebuild
4.784 overall
bash-5.0$


Interesting is here: The compact *meson.build* file (only 125 lines) generates
fast a realy clear *build.ninja*, but needs more time to build (old i386 with
only 2 cores). Overall for this small project, mesonbuild is faster.
1.136 gen
0.427 build
0.054 empty build
0.103 clean
0.432 rebuild
2.152 overall
clausklein$

Interesting is here: The compact *meson.build* file (only 120 lines) generates
fast a realy clear *build.ninja*.
Overall for this small project, mesonbuild is faster.

IMHO: The winner seems https://mesonbuild.com using https://ninja-build.org and https://ccache.dev

Expand Down
Loading