CLI1 vs CLI2 build size + time

for CLI1 are you using .mbedignore ?

Yes, I use this .mbedignore file in each CLI1 project. Actually, what CMake does in CLI2 (selects which files shall be compiled) the .mbedignore file can do in CLI1. The main difference is that while CMake applies a distributed approach (directory wise CMakeLists.txt files) the .mbedignore file enables a sort of centralized configuration concentrated in one file. Of course CMake offers much more but it’s also more complex than the .mbedignore file.

But my main interest was to compare the performance of the Ninja build system with the GNU make.

If so, can you try with an empty one?

Sure. But in this case the number of uselessly compiled files (files which are not used by the linker to create the final binary file) is much higher in CLI1 than in CLI2:

| Module           |         .text |       .data |        .bss |
|------------------|---------------|-------------|-------------|
| [fill]           |     614(+614) |       0(+0) |     19(+19) |
| [lib]/c.a        |   7268(+7268) | 2108(+2108) |     58(+58) |
| [lib]/gcc.a      |     776(+776) |       0(+0) |       0(+0) |
| [lib]/misc       |     188(+188) |       4(+4) |     28(+28) |
| main.o           |       16(+16) |       0(+0) |       0(+0) |
| mbed-os/cmsis    |   6306(+6306) |   168(+168) | 5953(+5953) |
| mbed-os/drivers  |       70(+70) |       0(+0) |       0(+0) |
| mbed-os/hal      |     470(+470) |       0(+0) |       2(+2) |
| mbed-os/platform |   3668(+3668) |   260(+260) |   348(+348) |
| mbed-os/targets  |   2248(+2248) |       4(+4) |   240(+240) |
| Subtotals        | 21624(+21624) | 2544(+2544) | 6648(+6648) |
Total Static RAM memory (data + bss): 9192(+9192) bytes
Total Flash memory (text + data): 24168(+24168) bytes

Build times:

real	2m44.892s
user	4m15.217s
sys	    0m52.540s