Same Performance for Both Routines???
From: Bryan Parkoff (bryan.nospam.parkoff_at_nospam.com)
Date: 03/27/04
- Next message: Robert Wessel: "Re: newbie about winAPI"
- Previous message: Bryan Parkoff: "JMP Is Optimized?"
- Next in thread: Matt Taylor: "Re: Same Performance for Both Routines???"
- Reply: Matt Taylor: "Re: Same Performance for Both Routines???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 27 Mar 2004 21:13:42 +0000 (UTC)
I have written my C++ source code before it is converted into machine
language. Here is the machine code below that it is done by C/C++ Compiler.
mov ecx,dword ptr [Low]
mov edx,dword ptr [High]
inc ecx
mov eax,ecx
and ecx,0FFh
shr eax,8
add edx,eax
push eax
and edx,0FFh
mov [Carry],eax
push edx
push ecx
push offset string "%X %X %X\n" (00408038)
mov dword ptr [Low],ecx
mov dword ptr [High],edx
call _printf
add esp,10h
ret
I don't like machine code above because it is not in the sequence order.
It can be difficult for me to understand, but I keep thinking the sequence
command. I have modified my machine code into sequence order. Here is
below.
mov ecx,dword ptr [Low]
inc ecx
mov eax,ecx
and ecx,0FFh
mov dword ptr [Low],ecx
shr eax,8
mov edx,dword ptr [High]
add edx,eax
and edx,0FFh
mov dword ptr [High],edx
mov [Carry],eax
push eax
push edx
push ecx
push offset string "%X %X %X\n" (00408038)
call _printf
add esp,10h
ret
Do you think that first machine code is really optimized than second
machine code because I did my own optimization by hand. How can you be sure
that first machine code is much faster than second machine code however the
cycle count is the EXACT same? Please advise with your ideas.
-- Bryan Parkoff
- Next message: Robert Wessel: "Re: newbie about winAPI"
- Previous message: Bryan Parkoff: "JMP Is Optimized?"
- Next in thread: Matt Taylor: "Re: Same Performance for Both Routines???"
- Reply: Matt Taylor: "Re: Same Performance for Both Routines???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|