Performance cost of passing by value vs. by reference or by pointer?
Let's consider an object foo (which may be an int , a double , a custom struct , a class , whatever). My understanding is that passing foo by reference to a function (or just passing a pointer to foo ) leads to higher performance since we avoid making a local copy (which could be expensive if foo is large). However, from the answer here it seems that pointers on a 64-bit system can be expected in practice to have a size of 8 bytes, regardless of what's being pointed. On my system, a float is 4 bytes. Does that mean that if foo is of type float , then it is more efficient to just pass foo by