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:
Interesting but if you want my opinion, the comparison on performance ought to be done on much bigger source tree.
Concerning the size it is probable that meson generated ninja file is simpler. Note however that in your case this does not seem to impair the build time.
In my experience with bigger source tree (+500 targets to build with 1000+ source files) with CMake + ninja, the generation time may be quite long (~ 1min) and the build is as fast as your host can handle in terms of CPU, memory a I/O.
The biggest issue with CMake w.r.t. to big monolithic project is the cost of regeneration time.
This is my own experience though.
So meson is better for the initial gen time, and generated ninja file size, but it is way slower for initial build of rebuild.
Note that, jsoncpp is a better base code, but he has only 10kloc of C/C++ , which is not that big.
I don’t really know where the differences are (disk I/O may be, ccache size ?) but the current comparison, seems too simple, to give appropriate answer on bigger project (250 kloc like cmake itself) or on bigger machine (20 core+, multi GiB RAM) like the one you usually setup for a fast CI.
Try this branch again, I have changed the project settings to be more comparable. The meson build release, and make includes some CTEST stuff. My setup was not right!
And, do not forget: run the test at least 2 time to fill the ccache.
On my old macbook pro, I have only 2 cores. 12 year old, but it still works (slow)
Not really, like I said jsoncpp is better but still really small w.r.t. parallel build.
If you dump the ninja dep graph using:
ninja -t graph | dot -o the-build.png -Tpng
you’ll see that the best you can get in a 5 parallels jobs and not for long since the graph
only counts 11 files to build. So you really don’t have enough build parallelism to evaluate parallel build.
In the same way try to: export NINJA_STATUS=[%f/%t (%r) - %e]
then build with ninja -v -j 5
you’ll see how that very soon you end up with only 2 parallel build jobs.
Don’t get me wrong the comparison is interesting but you won’t certainly get the full power of ninja (neither with CMake nor meson) unless you have a bigger parallel build to do. i.e. 1000+ items to build and mean possible parallelism greater than 8 or more which any average desktop machine will
have nowadays (no offense to your computer or mine).
And yes I warmed-up the ccache before running the tests.
@Eric Noulard Do you have your python script to share? I’m not a python guy but I could throw the test at our project (http://github.com/bluequartzsoftware/dream3d) which has about 1500 files and about 500Kloc to compile. Typical 12C/24T systems take about 20 Minutes to compile it.
ITK/VTK/ParaView would also all be good targets to try this out on.