www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/21/17:26:01

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: memcpy(); is there something faster?
Date: Sat, 21 Dec 1996 21:10:54 +0000
Organization: None
Lines: 20
Distribution: world
Message-ID: <V7F25CAeJFvyEw5d@talula.demon.co.uk>
References: <59g08k$758_001 AT cpe DOT Maroochydore DOT aone DOT net DOT au>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Daniel Everton writes:
>In a program I'm currently writing I need to copy some biggish (64k) 
>shunks of memory around. I'm using memcpy() at the moment but it's not 
>quite fast enough. Is there some other function that any one can 

I very much doubt you will be able to get anything faster than memcpy,
even if you do it all yourself in asm. As long as you are compiling with
optimisation (-O or -O2) gcc will inline the memcpy function into a
single rep ; movs, which is as fast as you can get. Although it just
occurs to me - this inlining might not happen if the size of the copy is
variable, so you should make sure you are using a constant block size.

The limiting factor here, though, is bus bandwidth rather than code
efficiency. If memcpy() isn't fast enough, I think you'll need to make
some improvements to your algorithm...

/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
 */

- Raw text -


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