in c++
class bar { int i; char b; float d; }; void foo ( bar arg ); void foo ( bar &arg ); void foo ( bar *arg );
this i
Function foo can modify arg in cases 2 and 3. In first cases compiler could optimize copy creation, so it is very hard to compare cpu and memory usage.