delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/25/06:01:09

Sender: crough45 AT amc DOT de
Message-Id: <97Nov25.120211gmt+0100.17031@internet01.amc.de>
Date: Tue, 25 Nov 1997 11:52:46 +0100
From: Chris Croughton <crough45 AT amc DOT de>
Mime-Version: 1.0
To: cellis AT voyageur DOT ca
Cc: djgpp AT delorie DOT com
Subject: Re: djgpp slow (source files)

"J.E." <cellis AT voyageur DOT ca> wrote:

> What!?  Man, all this time I figured that using words (with my 16-bit
> assembler) to copy buffers and stuff was faster than using bytes.  Why
> is using bytes faster than using words?  

If you are in 16-bit mode on the x86 then 16-bit move instructions
are indeed faster than 8-bit.  However, if you are in 32-bit mode
(as programs written with DJGPP are) then 16-bit is slower than
32-bit or 8-bit because it has to change mode to do a 16-bit
instruction (it's also larger because it needs a prefix byte per
instruction).

So if you're in assembler using something like TASM or MASM, then
doing movsw is faster.  If you're using GCC inline assembly or
gas then movsw is slower.

Chris C

- Raw text -


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