Re: No difference on my machine
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Sun, 11 Nov 2007 05:01:01 GMT
Evenbit wrote:
Comparing 'xor eax, eax' with 'mov eax, 0' from the CLAX thread:
; nasm -f elf -o timeit.o timeit.asm
; gcc -s -o timeit timeit.o
extern exit
extern printf
global main
section .data
tvsec dd 0
tvusec dd 0
tz1 dd 1
tz2 dd 0
secs db "Sec: %i", 10, 0
store dd 0
section .text
main:
mov eax, 78 ; gettimeofday
mov ebx, tvsec
mov edx, tz1
int 0x80
mov eax, DWORD [tvsec]
mov DWORD [store], eax
mov ecx, 2
mainloop:
mov edx, -1
subloop:
xor eax, eax ; exchange with 'mov eax, 0'
dec edx
jnz subloop
dec ecx
jnz mainloop
mov eax, 78
mov ebx, tvsec
mov edx, tz1
int 0x80
mov eax, DWORD [tvsec]
sub eax, DWORD [store]
push eax
push secs
call printf
push 0
call exit
Good one, Nathan! No difference on my P4, that I can notice. Replacing "dec" with "sub" gives a big speedup, though...
Don't you want "tz" in ecx, not edx?
Best,
Frank
.
- Follow-Ups:
- Re: No difference on my machine
- From: Evenbit
- Re: No difference on my machine
- References:
- No difference on my machine
- From: Evenbit
- No difference on my machine
- Prev by Date: Re: oRosAsm
- Next by Date: Re: oRosAsm
- Previous by thread: No difference on my machine
- Next by thread: Re: No difference on my machine
- Index(es):
Relevant Pages
|
|