Non- static member functions have an implicit this parameter. If your function does not use any non- static elements, it should be either a free function or a static member function, depending on what namespace you want it to be . This will avoid confusion for people reading (who will scratch their heads looking for a non- static reason), and will be a slight improvement in code size, which probably cannot be measured in performance.
To be clear: in asm, there is zero difference between the static member function and the non-member function . The choice between static-member and global or static (file area) is purely a namespace quality and design issue, not a performance issue. (In Unix-shared libraries (position-independent code), calls to global functions have a level of indirection via PLT, so prefer static to scope functions of the file. This is another value for the keyword static vs. global static -member, which are globally visible and therefore subject to symbolic movement .)
One possible exception to this rule is that wrapper functions that pass most of their arguments unchanged to another function can have their arguments in the same order as the function they call, so they donโt need to move them between registers, for example, if a member function does something simple for a class member, and then calls a static member function with the same list of arguments, it actually does not have an implicit this pointer, so all arguments must be moved in the same register.
Most ABIs use the args-in-registers calling convention. 32-bit x86 (different from some Windows conventions) is the main exception that I know of, where all arguments are always passed to the stack. 64-bit x86 passes the first 6 integer arguments to registers, and the first 8 arguments to FP in hmm registers ( SysV ). Or the first 4 arguments of args of any type in registers (Windows).
Passing an object pointer usually takes an extra team or two at each call site. If the implicit first arg removes any other arguments from the limited set of arg-pass regs, then it must be pushed onto the stack. This adds several latency cycles to the critical path, including this argument for round trip, as well as additional instructions for the called party and the calling party. (See the x86 wiki for links to other details about this, for this platform).
An attachment, of course, eliminates this. static functions can also be optimized by modern compilers, since the compiler knows that all calls come from code that he can see, so he can make them non-standard. IDK, if any compiler fails unused arguments during optimization between procedures. Link time and / or optimization of the entire program can also reduce or eliminate overhead from unused arguments.
The size of the code always matters, at least a little, since smaller files load from disk faster and skip less in the I-cache. I do not expect any measurable difference in speed unless you specifically design an experiment that is sensitive to it.