2 ms·
Splitting everything in small files makes it so that very little needs to recompile when you change something. Linking is pretty much just I/O-bound unless you
by mgaunard 3y ago
Splitting everything in small files makes it so that very little needs to recompile when you change something.
Linking is pretty much just I/O-bound unless you're using LTO. This is assuming you're using a modern linker like mold.
- flohofwoe 3y agoYou also need to put into consideration though there are no "small" source files anymore as soon as you include anything from the C++ stdlib. Each tiny source file ends up anywhere between 20 and 100kloc after includes. Also, many C++ projects I've seen indirectly include almost anything into anything under the hood, so a header change on one end of the project may trigger a rebuild of seemingly unrelated source files.
- mgaunard 3y agoThey're small in the sense that their dependency on the rest of your codebase is small.