Newsgroups: comp.sys.mac.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!psuvax1!swatsun!jackiw From: jackiw@cs.swarthmore.edu (Nick Jackiw) Subject: Re: Optimizing Copybits Message-ID: Reply-To: jackiw@cs.swarthmore.edu (Nick Jackiw) Organization: Visual Geometry Project, Swarthmore College, PA References: <1990Aug2.223758.13691@murdoch.acc.Virginia.EDU> Distribution: usa Date: Fri, 3 Aug 90 13:57:19 GMT mil@mendel.acc.Virginia.EDU (Maria I. Lasaga) writes: > > > We need to optimize the speed with which copybits places a complex > image from an offscreen port to the screen. > Based on your description, there are a couple more tweaks you can try. Make sure that the bit-maps are bit-aligned; i. e. that one pixel occupies the same bit (in whichever word its located in) in both the source and destination bitmaps. This keeps Quickdraw from having to rotate the data's bits before storing them. Also, make sure that rowBytes, and your srcRect/destRect's width, are multiples of four--this lets the processor copy data at maximum speed. In TechNote#277, Forrest Tanaka describes a number of the more significant factors which determine the speed of copyBits. Additionally, I'll send you (by e-mail) a more thorough description of bit alignment. > > We happened to expand RAM from 1 Meg to 2.5 Meg and surprisingly > to us, we cut down the drawing time to 1/4 of what it was before > the upgrade. If we expanded to 4 meg, would we cut down on the > drawing time further? (Why did additional RAM speed up the > copybits procedure in the first place?) No idea whatsoever. Even if the new RAM were faster, that shouldn't influence the actual access speed. If you're unloading and reloading segments from disk, a larger memory partition will of course reduce this activity. But if you're trying to optimize copyBits, cutting out disk activity altogether is the best place to start... > > What more can we do? What are we doing wrong? We need to get > the drawing times as close to 1 refresh cycle as possible. (This > program is for an experiment in visual perception.) 20K of data at 60hz? I doubt you'll make it. My SE/30 can't do that in a tight display loop with major optimizations in place... > -------------------------------------------------------------------------- > Maria Lasaga > Department of Psychology > Gilmer Hall > University of Virginia > Charlottesville, Virginia 22903 > -------------------------------------------------------------------------- -- ------------------------ Nick Jackiw jackiw@cs.swarthmore.edu "Every minute of the future Visual Geometry Project jackiw@swarthmr.bitnet is a memory of the past." Swarthmore College, PA 19081-1397 -Laivach