I mentioned in a mail earlier that compile times can seem a bit long at times. I analyzed a random, small, file in Blink:
core/html/track/VideoTrack.cpp which should on the surface be very easy to compile and yet needs a couple of seconds.
Turns out that the whole compilation unit is about 180,000 lines after preprocessing in clang (a bit longer in gcc) and the compilation time is more or less proportional to the number of lines.

So of 180,000 lines, everything but 65 lines are headers.
0.04% is the cpp file, 99.96% are headers.
There is nothing special with the headers, just the normal mix you get when you include a lot of them:
It is not very efficient to compile 180,000 lines of headers to compile a few dozen lines of "real" code, so there are already some ideas how to work around this. One idea is to precompile headers so that, while 180,000 lines, they take less time to compile.
Another idea is to increase those 66 lines to something larger so that instead of 0.04% it's 1%, 10% or even 60% of the code. In an existing code base like Blink you can easily do that by merging different cpp files in a wrapper file.
As a testing ground I choose the core/html folder and got these results:
CPU time went from 25.5 minutes to 1.0 minutes, a speedup of 25x. The wall time speedup was less, but only because I didn't use all cores anymore. If this is applied to several places the wall time improvement would become similar.
I repeated the PoC change for layout, svg, dom and css making it 5 different large files (still not enough to fill all logical cores) and got this improvement:
In CPU time it is 5 minutes instead of 76 minutes. In wall time it is 1 minute instead of 10 minutes.
For the record, here is a similar graph as the first one for all of Source/core/html:
The downside to merging classes like this is that if you only want to compile a single class (assuming you just changed the cpp file) you will now have to compile more than one. In the example with mergine 250 files into one, you might lose 40-50 seconds compared to the fastest possible turnaround. Smaller groupings and the difference will of course be less.
I think this is something worth trying, but primarily I wanted to check how large the improvement seemed to be and how large effort was required. The effort was very small, but then I handled the handful of name collisions mostly by giving one instance a dummy suffix. A proper fix should have been deduplication or better chosen names.
/Daniel
--
/* Opera Software, Linköping, Sweden: CET (UTC+1) */