结论

  • 可以看出 debug要比release编译快,因为不需要优化,所以中测试release。
  • m3 是r9000p4- 8倍,编译极快。
  • configure Generating 速度,M3pro最快,msvc还是挺快的.不同平台选项不一样
  • windows编译,msvc最快,clang18.1其次,mingw最慢。
  • linux和mac,configure/编译/文件操作都比windows要快。
  • cmake/gcc/clang,不加选项,默认是不开优化版本,除非给-DCMAKE_BUILD_TYPE=Release,或者程序里面有设定。

libpng-1.6.43

1
2
3
4
cmake -S . -B build_release -DCMAKE_BUILD_TYPE=Release

time cmake --build build_release --parallel 4

cmake —build build_release —parallel 4 7.03s user 1.48s system 263% cpu 3.236 total

1
2
3
cmake -S . -B build_debug -DCMAKE_BUILD_TYPE=Debug

time cmake --build build_debug --parallel 4

cmake —build build_debug —parallel 4 7.08s user 1.48s system 273% cpu 3.127 total

Sdl2

Mac m3pro

release

cmake —build build_release —parallel 4 38.91s user 10.09s system 310% cpu 15.801 total

debug

cmake —build build_debug —parallel 4 38.11s user 9.80s system 309% cpu 15.496 total

r9000p ubuntu24虚拟机 gcc13.2

release

1
2
3
cmake -S . -B build_release -DCMAKE_BUILD_TYPE=Release

time cmake --build build_release --parallel 4

— Configuring done (27.3s)

real 0m47.944s

debug

1
2
3
cmake -S . -B build_debug -DCMAKE_BUILD_TYPE=Debug

time cmake --build build_debug --parallel 4

— Configuring done (26.1s)

real 0m25.052s

r9000p ubuntu24虚拟机 gcc13.2- ninjia

1
2
3
cmake -S . -B build_release_ninja -DCMAKE_BUILD_TYPE=Release -G Ninja

time cmake --build build_release_ninja --parallel 4

— Configuring done (25.6s)

real 0m43.414s

r9000p-msvc

release

1
2
3
cmake -S . -B build_release_msvc -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe

time cmake --build build_release_msvc --parallel 4

Configuring done (20.5s)

real 0m56.113s
user 0m0.000s
sys 0m0.031s

debug

1
2
3
cmake -S . -B build_debug_msvc -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe

time cmake --build build_debug_msvc --parallel 4

real 0m37.969s
user 0m0.000s
sys 0m0.031s

r9000p-msys2-gcc14.2

release

1
2
3
cmake -S . -B build_release -DCMAKE_BUILD_TYPE=Release

time cmake --build build_release --parallel 4
  • Configuring done (131.5s)

real 1m58.814s
user 0m0.000s
sys 0m0.062s

debug

1
2
3
cmake -S . -B build_debug -DCMAKE_BUILD_TYPE=Debug

time cmake --build build_debug --parallel 4

real 1m48.265s
user 0m0.000s
sys 0m0.046s

r9000p-mingw gcc14.1-release

1
2
3
cmake -S . -B build_release_gcc14  -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="C:\softwares\winlibs-x86_64-posix-seh-gcc-14.1.0-llvm-18.1.5-mingw-w64ucrt-11.0.1-r1\mingw64\bin\gcc.exe" -DCMAKE_CXX_COMPILER="C:\softwares\winlibs-x86_64-posix-seh-gcc-14.1.0-llvm-18.1.5-mingw-w64ucrt-11.0.1-r1\mingw64\bin\g++.exe"

time cmake --build build_release_gcc14 --parallel 4

— Configuring done (151.1s)

real 2m17.339s
user 0m0.000s
sys 0m0.078s

r9000p-clang18.1-release

1
2
3
cmake -S . -B build_release_clang18  -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="C:\softwares\llvm-mingw-20240502-msvcrt-x86_64-gcc-15.0.0\llvm-mingw-20240502-msvcrt-x86_64\bin\clang.exe" -DCMAKE_CXX_COMPILER="C:\softwares\llvm-mingw-20240502-msvcrt-x86_64-gcc-15.0.0\llvm-mingw-20240502-msvcrt-x86_64\bin\clang++.exe"

time cmake --build build_release_clang18 --parallel 4

Configuring done (123.2s)

real 1m19.999s
user 0m0.000s
sys 0m0.062s

参考

https://www.cnblogs.com/findumars/p/14213309.html