Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Faster compiling for VCMI
### UPD: Automated benchmark is here:
https://gist.github.com/ArseniyShestakov/b96676d1db994983ca26
# My results are:
# GCC 4.8 compile whole VCMI project within 3:20-3:30
# Clang 3.7 compile it within 1:50-2.05
apt-get install clang-3.7
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-3.7 100
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.7 100
update-alternatives --config cc
update-alternatives --config c++
# Following tests all made with Clang 3.7 as compiler
# Gold as linker:
apt-get install binutils
update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 100
# Usage of gold instead of "ld" decreased compile+linking time for another 5-10 seconds
# It's hard to notice the difference for full build, but difference in link time for libvcmi is huge:
# Linking with ld take 13 seconds
# Linking with gold only take 2 seconds
# Default ld linker can be added this way:
update-alternatives --install /usr/bin/ld ld /usr/bin/ld.bfd 110
## Also tested ninja instead of make:
apt-get install ninja-build
mkdir ninjab && cd ninjab
cmake ../vcmi -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -DCMAKE_MAKE_PROGRAM=ninja
ninja -j 9
ninja clean
## clang + ld + make
#real 1m58.039s
#real 1m59.281s
#clang + ld + ninja
#real 1m46.949s
#real 1m45.195s
#clang + gold + ninja
#real 1m28.366s
#real 1m30.472s
#clang + gold + make
#real 1m37.071s
#real 1m37.456s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment