Metaswitch/homestead — pull request #150 by bossmc (2014-09-17 23:37:32+00:00)
Title: Reviewer Alex - Speed up incremental compiles

Don't say I'm not nice to you! Taking a hint from https://code.google.com/p/googlemock/wiki/CookBook#Making_the_Compilation_Faster, I've move the constructors of many of our GoogleMock objects out to their own files. This makes negligible difference to a fresh build, but speeds up incremental builds by a decent amount.

Before:

```
ubuntu@ip-10-48-154-121:~/src/homestead-ng/src$ touch ut/handlers_test.cpp
ubuntu@ip-10-48-154-121:~/src/homestead-ng/src$ time make build_test
/home/ubuntu/src/homestead-ng/build/obj/homestead_test/handlers_test.depends
g++ -c ut/handlers_test.cpp
g++ -o /home/ubuntu/src/homestead-ng/build/bin/homestead_test

real 0m29.575s
user 0m26.546s
sys 0m2.928s
```

After:

```
ubuntu@ip-10-48-154-121:~/src/homestead-ng/src$ touch ut/handlers_test.cpp
ubuntu@ip-10-48-154-121:~/src/homestead-ng/src$ time make build_test
/home/ubuntu/src/homestead-ng/build/obj/homestead_test/handlers_test.depends
g++ -c ut/handlers_test.cpp
g++ -o /home/ubuntu/src/homestead-ng/build/bin/homestead_test

real 0m20.668s
user 0m18.197s
sys 0m2.384s
```

Factoring out the `0m3.831s` it takes to do the link afterwards, this has reduced the compilation time of that file by **35%**.

Further gains can be made elsewhere by doing the same trick to other mock classes, but I've focussed on the "long pole in the tent" to get the best "bang for buck"... "synergy".