Performance cost of passing by value vs. by reference or by pointer?

It depends on what you mean by “cost”, and properties of the host system (hardware, operating system) with respect to operations. If your cost measure is memory usage, then the calculation of cost is obvious – add up the sizes of whatever is being copied. If your measure is execution speed (or “efficiency”) then the … Read more