Last active
August 3, 2017 19:30
-
-
Save ArseniyShestakov/2a6bb4accb3ce8a6cca2 to your computer and use it in GitHub Desktop.
Faster compiling for VCMI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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