Re: which way is faster?




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



.



Relevant Pages

  • Re: which way is faster?
    ... For example, I can add to allocated variables, and I can move them to ... addition in the registers is faster. ... MOV eax, ... cycles I read, inclusive, Using your previously posted technic. ...
    (alt.lang.asm)
  • Re: which way is faster?
    ... I wonder which way is faster while doing arithmetical expressions. ... For example, I can add to allocated variables, and I can move them to ... addition in the registers is faster. ... MOV eax, ...
    (alt.lang.asm)
  • Re: howto: MOV EAX, <64bit value> ?
    ... mov eax, ... MOV and the same number of 'pull' instructions on the other. ... wise compression routine to get them to fit into the 8-bit registers. ...
    (alt.lang.asm)
  • Re: Help in getting application to access I/O space
    ... pointers for how to do 32-bit I/O space accesses, ... BYTE inpb(USHORT addr) ... mov dx, addr ... the registers are mapped as offsets into "I/O Space". ...
    (microsoft.public.windowsce.embedded)
  • Re: Help in getting application to access I/O space
    ... BYTE inpb(USHORT addr) ... mov dx, addr ... the registers are mapped as offsets into "I/O Space". ...
    (microsoft.public.windowsce.embedded)