compiler options were for VC++ 6.0 compiler: /nologo /G3 /ML /W3 /GX /Zd /O2 /Ob0 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" Fp"Release/test2.pch" /YX /Fo"Release/" Comparing both versions, the pass by reference code requires one "push GPR" instruction less. passing by reference: // saving 1. mov ecx,dword ptr [esp] // 2. push ecx, // compared to the by value version // 28: void main() 29: { 00401040 sub esp,8 30: Point v, v2; 31: 32: v2=moveRef(v, 1, 2); 00401043 push 2 00401045 lea eax,[esp+4] 00401049 push 1 0040104B push eax 0040104C call moveRef (00401000) 33: //v2=moveValue(v, 1, 2); 34: 35: dummy(v2); 00401051 lea ecx,[esp+0Ch] 00401055 mov dword ptr [esp+0Ch],eax 00401059 push ecx 0040105A mov dword ptr [esp+14h],edx 0040105E call 00400000 36: } 00401063 xor eax,eax 00401065 add esp,18h 00401068 ret passing by value void main() 29: { 00401040 sub esp,8 30: Point v, v2; 31: 32: //v2=moveRef(v, 1, 2); 33: v2=moveValue(v, 1, 2); 00401043 mov eax,dword ptr [esp+4] 00401047 mov ecx,dword ptr [esp] 0040104B push 2 0040104D push 1 0040104F push eax 00401050 push ecx 00401051 call moveValue (00401020) 00401056 mov dword ptr [esp+14h],edx 34: 35: dummy(v2); 0040105A lea edx,[esp+10h] 0040105E push edx 0040105F mov dword ptr [esp+14h],eax 00401063 call 00400000 36: } 00401068 xor eax,eax 0040106A add esp,1Ch 0040106D ret // passing by reference // costs: // 1. mov ecx,dword ptr [esp+4] // compared to the by reference version // 10: struct Point moveRef(const Point& a, int x, int y) 11: { 12: Point result = a; 00401000 mov ecx,dword ptr [esp+4] 00401004 mov eax,dword ptr [ecx] 00401006 mov edx,dword ptr [ecx+4] 13: result.x += x; 00401009 mov ecx,dword ptr [esp+8] 0040100D add eax,ecx 14: result.y += y; 0040100F mov ecx,dword ptr [esp+0Ch] 00401013 add edx,ecx 15: return result; 16: } 00401015 ret // passing by value 19: Point moveValue(Point a, int x, int y) 20: { 21: 22: a.x += x; 00401020 mov eax,dword ptr [esp+4] 00401024 mov edx,dword ptr [esp+0Ch] 23: a.y += y; 00401028 mov ecx,dword ptr [esp+10h] 0040102C add eax,edx 0040102E mov edx,dword ptr [esp+8] 00401032 add edx,ecx 24: return a; 25: } 00401034 ret