Paste: function call cost microbenchmark (x86/core2)

Author: prunedtree
Mode: factor
Date: Fri, 23 Jan 2009 07:32:10
Plain Text |
10k iterations, i += f(i) where f(x) = x
inline 20076
direct 70080
indirect 80103
virtual 80197
(in cycles, core2, 32 bit)

; 191  :     for (int i=0; i<N; i++)

  00023	33 c0		 xor	 eax, eax
$L1176:

; 192  :       k += i;

  00025	03 f0		 add	 esi, eax
  00027	40		 inc	 eax
  00028	3d 10 27 00 00	 cmp	 eax, 10000		; 00002710H
  0002d	7c f6		 jl	 SHORT $L1176

; 200  :     for (int i=0; i<N; i++)

  00053	33 f6		 xor	 esi, esi
$L1183:

; 201  :       k += f_direct(i);

  00055	56		 push	 esi
  00056	e8 00 00 00 00	 call	 ?f_direct@@YAHH@Z	; f_direct
  0005b	83 c4 04	 add	 esp, 4
  0005e	03 f8		 add	 edi, eax
  00060	46		 inc	 esi
  00061	81 fe 10 27 00
	00		 cmp	 esi, 10000		; 00002710H
  00067	7c ec		 jl	 SHORT $L1183


; 209  :     for (int i=0; i<N; i++)

  0008d	33 f6		 xor	 esi, esi
$L1189:

; 210  :       k += f_indirect(i);

  0008f	56		 push	 esi
  00090	ff 15 00 00 00
	00		 call	 DWORD PTR ?f_indirect@@3P6AHH@ZA ; f_indirect
  00096	83 c4 04	 add	 esp, 4
  00099	03 f8		 add	 edi, eax
  0009b	46		 inc	 esi
  0009c	81 fe 10 27 00
	00		 cmp	 esi, 10000		; 00002710H
  000a2	7c eb		 jl	 SHORT $L1189


; 218  :     for (int i=0; i<N; i++)

  000c8	33 f6		 xor	 esi, esi
$L1195:

; 219  :       k += obj->f_virtual(i);

  000ca	8b 0d 00 00 00
	00		 mov	 ecx, DWORD PTR ?obj@@3PAVObject@@A ; obj
  000d0	56		 push	 esi
  000d1	8b 01		 mov	 eax, DWORD PTR [ecx]
  000d3	ff 50 04	 call	 DWORD PTR [eax+4]
  000d6	03 f8		 add	 edi, eax
  000d8	46		 inc	 esi
  000d9	81 fe 10 27 00
	00		 cmp	 esi, 10000		; 00002710H
  000df	7c e9		 jl	 SHORT $L1195

New Annotation

Summary:
Author:
Mode:
Body: