Re: while ();
På 30 Jan 2006 13:57:31 -0800, skrev <robertwessel2@xxxxxxxxx>:
and it certainly wount matter
at all then, because 3 iterations will be closer to nothing.
Obviously the notion that a loop with few iterations might be inside a
big loop has escaped you.
?? :)
If you have a million iterations around a
small loop of two or three iterations the performance of the small loop
will most certainly matter, and with that few iterations branch
(mis)prediction will be a significant issue.
:) Wrong! Following is code to show you wrong.
main:
rdtsc | push eax edx
mov ecx 1_000_000
..while ecx > 0
mov ebx 3
While ebx > 0
dec ebx
End_While
dec ecx
..End_While
rdtsc | pop ecx ebx
sub eax ebx
sbb edx ecx
int 3
******************************************************
result (varies in the 5th digit from right)
0112_A91D
******************************************************
This is an inner loop doing 3 times as much
rdtsc | push eax edx
mov ecx 1_000_000
..while ecx > 0
mov ebx 3
While ebx > 0
dec ebx
dec esi
dec edi
End_While
dec ecx
..End_While
rdtsc | pop ecx ebx
sub eax ebx
sbb edx ecx
int 3
call 'KERNEL32.ExitProcess' 0
******************************************************
result (also varies in the 5th digit from right)
0112_DC16
******************************************************
What you claim is irrelevant from a optimization perspective.
.
Relevant Pages
- Re: First NASM attempt (Windows XP)
... registers to hold the loop counter without getting an infinite loop, ... I would prefer to use ecx, ... preserve ebx, esi, edi, and of course ebp. ... add esp, 4 ... (comp.lang.asm.x86) - [NT] Race Driver Security Issues and DoS
... u_long eax; ... u_long ecx, ... ebx = edx; ... (Securiteam) - Re: Fastcode Libraries
... add eax, ecx ... mov ebx, ... cmp ebx, ... jne @Ret0 ... (borland.public.delphi.language.basm) - Re: Newbie question...
... push ebp ... push ebx ... mov ebx, DWORD PTR ... mov ecx, DWORD PTR ... (alt.lang.asm) - Re: Fastcode UpperCase B&V 3.6.1
... test edx, edx ... mov ebx, edx ... add ecx, $05050505 ... add edi, ebx ... (borland.public.delphi.language.basm) |
|