Faster builds under Linux. Down to 90 seconds from 174

So today I’m decide to find out how to improve build time of VCMI for faster development and fun. Testing done with current develop with zero changes. Currently I checked following things:
[ul]]Compiler: Clang instead of GCC/:m]
]Linker: Gold instead of LD(bfd)/:m]
]Build system: Ninja instead of Make/:m][/ul]
Results are interesting:

GCC   + LD   + make:  2m54.822s
GCC   + LD   + ninja: 2m48.367s

GCC   + Gold + make:  2m48.589s
GCC   + Gold + ninja: 2m37.814s

Clang + LD   + make:  1m53.399s
Clang + LD   + ninja: 1m43.988s

Clang + Gold + make:  1m36.344s
Clang + Gold + ninja: 1m29.530s

Log with file sizes (suggested by @AVS for linker comparison):
gist.github.com/ArseniyShestako … 1fdcf148f1
Full log with Clang warnings (omg it’s HUGE):
gist.github.com/ArseniyShestako … f26731cbc7

My system is:

  • i7 4771 with 32GB RAM
  • OS files are on SSD
  • Ubuntu 14.04 with kernel 3.19
  • I do have some kernel tweaks:
    • Preemption Model set to Low Latency Desktop
    • Timer frequency set to 1000HZ
      Both tweaks done for QEMU VMs so they unlikely affect build speed.
  • All software from repositories:
    GCC 4.8.4
    Clang 2.7
    Cmake 2.8.12.2
  • Source code, temporary and build files in RAM (2gb is enough)

Setup commands for Ubuntu 14.04 available there:
gist.github.com/ArseniyShestako … 3ce8a6cca2
Benchmark script can be found there:
gist.github.com/ArseniyShestako … 994983ca26

Little about how it’s affect real development for me. Usually I don’t recompile everything too often (except when I want to test different branch), but Clang+Gold does decrease linking time of libvcmi a lot. So for small changes within .cpp files I now get almost instant recompilation instead of waiting like ~10-15 seconds for linking. :slight_smile: