* Kristian Nielsen <knielsen@stripped> [09/06/30 13:02]:
> Just for fun, I did some quick benchmarking on building the latest mysql 5.1
> bzr tree on a cheap 2-year old quad-core. First, compiling one file in sql/
> vs. compiling all:
> `touch sql/mysqld.cc ; make -j5` -> 11.35 seconds, 121% CPU.
> `touch sql/*.cc ; make -j5` -> 120.87 seconds, 352% CPU.
> So that is a factor of only 10 between compiling one and all C++ sources. Of
> course that is still something if we can get down to only one (or a few) files
> #including something vs. all doing so.
> Second, I tried adding #include <elf.h> (random 100k bytes, 2.5k lines file)
> at the start of every .cc file in sql/, and timing `make -j5` after
> `make clean`:
> Without #include <elf.h>: 5 min 14 sec
> With #include <elf.h>: 5 min 17 sec
> So not much difference there (may even be less than the statistical noise).
> Anyway, thanks for the explanation,
It's not so important how long it takes to compile from scratch.
What matters is compiling while developing, when you change a single
header in a single part of the system, and then sit and wait for the
compilation results. For me, the time sufficient to lose
concentration and switch to "something else" is about 10 seconds.
Even ccache can not make recompilation of the entire server be as fast
as 10 seconds.
So, "single include file" profoundly changed my programming
habits.
Rather than making a small change, compiling and then running a test,
coding sessions with no compilation or testing extend to hours.
In my view, this simple issue leads to ugly and pervasive
transformation of the development practice and degrades
performance.
--