Date: Tue, 15 Apr 1997 12:58:45 +0300 (EEST) From: Adrian Oboroc To: Jeff Weeks 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: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 ;)