Re: which way is faster?
- From: "Wolfgang Kern" <nowhere@xxxxxxxx>
- Date: Thu, 10 Jan 2008 12:35:06 +0100
shikamuk asked:
Hello
I wonder which way is faster while doing arithmetical expressions.
For example, I can add to allocated variables, and I can move them to
the registers and then add.
Probably, addition in the registers is faster.
But what about time to move them to the registers?
Every memory access takes its time, also if already cached or on stack.
ADD [mem],... is a good example of a READ-MODIFY-WRITE sequence,
and it is faster than its discrete replacement:
MOV eax,[var1]
MOV ebx,[var2]
ADD eax,ebx
MOV [var1],eax
is much slower than:
MOV eax,[var2]
ADD [var1],eax
but it also depends on where you want the result
ie:
MOV eax,[var2]
ADD eax,[var1]
is a few micro-cycles faster than with [mem] as result destination.
__
wolfgang
.
- Follow-Ups:
- Re: which way is faster?
- From: //\\\\o//\\\\annabee
- Re: which way is faster?
- From: //\\\\o//\\\\annabee
- Re: which way is faster?
- References:
- which way is faster?
- From: shikamuk
- which way is faster?
- Prev by Date: Re: how do you start learning assembly language
- Next by Date: Re: how do you start learning assembly language
- Previous by thread: Re: which way is faster?
- Next by thread: Re: which way is faster?
- Index(es):
Relevant Pages
|