The main problem is compilation time, really.
If everything is included in a single master compilation unit, everything needs to be recompiled if you change one character in one file.
On the other hand, a complete rebuild will most likely be faster than if you used several compilation units (in this case, the same headers would need to be compiled several times, and the linker would have more work. With one compilation unit each the header needs to be processed only once, and the linker job is pretty trivial)
With multiple .cpp files, you can make changes to one of them and only recompile this file.
But several popular libraries only have a title. It is definitely viable.
In terms of performance, it should be the same or faster. You give the compiler full visibility throughout your code, which means that it can easily optimize function calls and embed whatever it likes.
And note that you never force the compiler to be embedded. The inline (and other tricks that have the same effect) do not tell the compiler that "this should be included." But, suppressing one definition rule (ODR), they allow you to include the definition in several compilation units, and therefore it becomes easier for the compiler to embed it if it wants to do this.
But that means you donโt have to worry about everything being included. The compiler will only embed as much as it makes sense to do.
source share