P
pamela fluente
Hmm he has published the code generated00B01003 83 EC 08 sub esp,8
00B01006 53 push ebx
int x = 0;unsigned int uTicks = timeGetTime();
00B01007 8B 1D E8 20 B0 00 mov ebx,dword ptr ds:
[00B020E8h]
00B0100D 56 push esi
00B0100E FF D3 call ebxfor( int i=0;i< 30000000; i++)
00B01010 8B F7 mov esi,edi
00B01012 89 45 FC mov dword ptr[ebp-4],eax
00B01015 69 F6 80 C3 C9 01 imul esi,esi,1C9C380h
{
x = x + param1;
}for( int i=0;i< 30000000; i++)
00B0101B B8 80 C3 C9 01 mov eax,1C9C380h
{
x = x - param1;
00B01020 2B F7 sub esi,edi
00B01022 48 dec eax
00B01023 75 FB jne 00B01020
}Is the first loop optimized by the compiler with a single
multiplication. Or i am getting it wrong ????
It could look like it.
Arne
i think that more precisely the assembly is something like:
x = param1;
x = x * 30000000;
to be fair, we should compare programs using in both the 1
multiplication for the first loop.
Does the timing improve ?
Pam