Giter VIP home page Giter VIP logo

build-performance's Introduction

Simple build performance comparison

These simple python scripts are based on the idea at https://mesonbuild.com/Simple-comparison.html

I use ccache and run the performance tests at least 2 times to decrease the compile time for each build test run.

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

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
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: 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: 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
cmake-ninja
 0.718 gen
 0.188 build
 0.013 empty build
 0.032 clean
 0.204 rebuild
 1.155 overall
meson
 1.611 gen
 0.237 build
 0.013 empty build
 0.022 clean
 0.219 rebuild
 2.101 overall

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 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$

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
cmake-ninja
 3.755 gen
 0.739 build
 0.018 empty build
 0.044 clean
 0.721 rebuild
 5.276 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.

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

Recources

A nice project with a dual build system: cmake and meson

Historic

build-performance's People

Contributors

clausklein avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.