Files are not essential to C++ compilation. Essentially, file-level modularity is just a matter of project development, maintainability, things like that — very important but not related to the result of compilation. In particular, there is no difference between .h and .cpp files (I am not talking about subtle detail, such as precompiled headers; I'm talking only about the results of compilation.) The files are just fed to the compiler in certain order, that's it.
The concept of file-level modularity is based on the C++ feature to allow multiple declarations and only one definition, and then on the linked which operates on the image names (string), that's all. (And, frankly, this conception is awfully archaic; I don't like it at all; it's no match to more advanced concepts used in some other languages. The techniques like precompiled headers is nothing but crutches.)
Indeed, inline function can give you some minor gain in performance. Note that a compiler may or may not take the benefit of inline functions. You can consider inline syntax as a recommendation to the compiler. Everything is explained, for example, here:
What is C++ inline functions — C++ Articles[
^].
To find out how much is the influence of this technique in each particular environment, you can perform timing of operation or
profiling.
—SA