Path: utzoo!attcan!uunet!husc6!bbn!mit-eddie!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer Subject: Re: BlockMove efficiency Message-ID: <8796@dartvax.Dartmouth.EDU> Date: 6 Jun 88 14:19:55 GMT References: <7212@watdragon.waterloo.edu> Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Distribution: comp Organization: Dartmouth College, Hanover, NH Lines: 31 In article <7212@watdragon.waterloo.edu> palarson@watdragon.waterloo.edu (Paul Larson) writes: > >I'm working of a Lightspeed Pascal program which basically juggles >single and double bytes from lookup tables into a coherent order. >I'm using the BlockMove call to accomplish this. How efficient >is BlockMove for things like this? > BlockMove isn't bad for general purpose use, and I probably couldn't do better. For specific cases, however, there is certainly room for speed improvement. BlockMove uses "move.b" for all moves, and strings a few of them together to gain a speed increase over a loop. If you are moving WORDs (integers, shorts, what have you) then you can move them much faster using "move.w" or "move.l". If you are moving LONGINTs, then you can move them a lot faster on a Mac II if they are aligned properly and you use "move.l." Take a look at the code which you would normally write to do the same move function in your high-level language. If it contains a loop, then BlockMove is probably indicated. If the source and destination are always aligned on even bytes, then maybe you want to write some assembler to do the same thing. What percentage of time do you spend actually doing the move? If this is small, maybe looping is just fine. Too bad, but if you really want to know the best method for use with your program, you have to time all of them, I think. ********************************************************************* *Earle R. Horton, H.B. 8000, Dartmouth College, Hanover, NH 03755 * *********************************************************************