Path: utzoo!attcan!uunet!samsung!usc!zaphod.mps.ohio-state.edu!mips!apple!motcsd!xdos!doug From: doug@xdos.UUCP (Doug Merritt) Newsgroups: comp.sys.amiga.tech Subject: Re: How do you draw to the screen quickly? Message-ID: <658@xdos.UUCP> Date: 11 Feb 90 17:22:51 GMT References: <1092@mindlink.UUCP> Reply-To: doug@xdos.UUCP (Doug Merritt) Organization: Hunter Systems, Mountain View CA (Silicon Valley) Lines: 28 In article <1092@mindlink.UUCP> a464@mindlink.UUCP (Bruce Dawson) writes: > > One way of speeding this up is to write your own WritePixel() routine. To give some idea, I did this for Thad's FaceShower program. It originally used WritePixel for displaying 256x256 (approx.) pixels, and took about 45 seconds. Changing to direct writes dropped it to around 20 seconds. So if that's the approximate amount of time you want to save, then this might be the way to go. (Factor of two.) But usually it's the algorithm that benefits most from optimization. Changing the inline dithering calculations to table lookups with layout optimized for the screen's bitplane layout dropped the time from 20 seconds to around 1 second. (Factor of twenty.) When I hand optimized the assembler in the inner loop, it went from 1.2 seconds to .85 seconds. (Factor of 1.4) The moral of this is obviously that you should always optimize the algorithm first, before you start dinking around with bypassing AmigaDos and hacking assembler. That's where the biggest wins are. Then again, running it on Thad's 68020 sped it up from 0.85 sec to 0.25 sec, and you can't beat a factor of 3.4 speedup with no source changes! :-) Doug -- Doug Merritt {pyramid,apple}!xdos!doug Member, Crusaders for a Better Tomorrow Professional Wildeyed Visionary