I had to remove the optimations for msvc to get that i wanted to actually loop
Anyways it seems to take 6 instructions per loop i have a 1.33Ghz Thunderbird (running at 1.00Ghz currently) and it takes about 6 seconds. That makes sense: 1Billion*6~6G Cpu cycles.Code:; 234 : for(int c=0;c<1000000000;++c); mov DWORD PTR _c$[ebp], 0 jmp SHORT $L8938 $L8939: mov eax, DWORD PTR _c$[ebp] add eax, 1 mov DWORD PTR _c$[ebp], eax $L8938: cmp DWORD PTR _c$[ebp], 1000000000 ; 3b9aca00H jge SHORT $L8940 jmp SHORT $L8939
This loop seems to be incredibly stupid anyway, I would use a register, and cut down the amount of instructions to 3. Probably something to do with the optimations.
Post your assembler listings and we'll see what's taking so long. I guess you have 8 cpu cycles (0.45*18=8)






Reply With Quote