[quote name='VReality' timestamp='1317922223' post='4869836']
There may be times when I'll put several related classes in one header for cohesive browsing, but break implementations out into multiple files.
I'd advise to put headers into their own files, and share the implementation in single cpp
if you must.
[/quote]
This was my disagreement.
[quote name='Codarki' timestamp='1316829409' post='4865372']
Low granularity on headers will cut the include chain, and having all implementation in single cpp file might imporpve link time optimization. Compile time will be shorter (unity build). But it will get messy.
Seems reasonable (if the shorter compile time you're referring to is for re-builds, and not incremental builds), but these techniques you're mentioning don't have much to do with the balanced approach you're disagreeing with.
[/quote]
This was my reasoning why one should prefer to put multiple classes in implementation file instead of header file, if you have a good reason to do so. Personally I usually put classes in their own files.
[quote name='Codarki' timestamp='1316829409' post='4865372']
Btw, there was a bench in internet that 60% of compile time went for writing the .bdp file, and when they split the project all went fast. It wasn't about include chains or repeated opening of files.
You mean splitting every class out to its own pair of files, as compared to shoving everything into only a couple files? Both seem needlessly extreme for practical use. It doesn't seem surprising that they saw improved compile times if they were testing a typical incremental-code-change-and-build pattern of work. Smaller files mean compiling less code per change.
[/quote]
No, I meant they split the project. Most of their time went constructing the .bdp file. Splitting it allowed them the build to multithread better.
[quote name='Codarki' timestamp='1316830204' post='4865376']
I'm talking from experience when our rebuild took over 30min.. and I got it under 10min.
By splitting the project code up into two files per class? You seem to be contradicting your prediction above, that bundling everything together will make a full rebuild faster.
[/quote]
No. I'd advice not to bundle everything together, unless you have good reason to do so (ie if you must). I didn't fix it by unity builds. I fixed it by removing excessive includes of headers.