www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/15/06:09:28

Date: Tue, 15 Apr 1997 12:58:45 +0300 (EEST)
From: Adrian Oboroc <oboroc AT usm DOT md>
To: Jeff Weeks <pweeks AT execulink DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: What is faster STOSD or MOVSD
In-Reply-To: <5iu501$rqj@nr1.toronto.istar.net>
Message-Id: <Pine.BSF.3.95q.970415124736.5288E-100000@usm.md>
Mime-Version: 1.0


On 14 Apr 1997, Jeff Weeks wrote:

> Which is faster?
> 
> rep stosd or
> rep movsd

Those two instructions have different functionality: first copies ECX
bytes from DS:ESI to ES:EDI in direction indicated by direction flag
(set/remove with std/cld). Values of ESI and EDI grows or degrade with
value of ECX*4. ECX is zero after the end of instruction. 

Second command fills ECX double words of memory at ES:EDI with value from
EAX. Direction depends from dir. flag and EDI grows with ECX*4, ECX is
zero after instruction. 

As you see the purposes of thous two commands is different: first is for
memory to memory blitting, second is for uniform memory filling. 
So speed comparision is a bit useless. But I think that MOVSD works slower
since it uses two memory regions, and STOSD only one.

> I've seen a few people currently using the later, which leads me to
> believe that it's faster, but my TASM book says that the former is
> faster.

Are you sure you ask your question in right newsgroup? TASM, generally
speaking, isn't good for DJGPP. Get NASM - Netwide Assembler.

> Please enlighten me, which is faster, and why?  They both perform
         ^^ with a great pleasure :-)

> essentially the same function right?
                                ^^^ not completly, doc ;)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019