Path: utzoo!attcan!uunet!dino!hascall From: hascall@cs.iastate.edu (John Hascall) Newsgroups: comp.lang.c Subject: Re: A study in code optimization in C Keywords: memcopy Message-ID: <2360@dino.cs.iastate.edu> Date: 30 Jul 90 14:13:38 GMT References: <133@smds.UUCP> <1990Jul26.144134.16053@ux1.cso.uiuc.edu> <134@smds.UUCP> Sender: usenet@dino.cs.iastate.edu Organization: Project Vincent, Iowa State University Computation Center Lines: 26 rh@smds.UUCP (Richard Harter) writes: }mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes: }> rh@smds.UUCP (Richard Harter) writes: }> >The macro shown below is an optimized memory to memory copy macro. }> >It is probably faster than memcopy on your machine -- I have checked }> >it on several machines and have always found it to be faster. }> Oh My!. } [Superior timings for a 20KB move on a 386 by memmove given] }Ouch. I should have phrased that more carefully. Yes, the gentleman }is quite right. As to be expected, a hardware bulk move is always }going to beat code that uses item by item move instructions. }In defense I have to point out that the quoted remark is accurate; }timings were made on 680x0 boxes, vaxes (!), and some risc boxes, ~~~~~ Hmmm, sorry, but here's a little more rain on your parade: VAXstation 3200 (admittedly, not the most modern VAX), 1000 20KB copies: memcpy: 3.18 your macro: 15.43 John Hascall / john@iastate.edu / hascall@atanasoff.cs.iastate.edu