Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.programmer Subject: Re: Lemmings - a tutorial Part V (last) Message-ID: Date: 5 Apr 91 19:00:25 GMT References: <1991Mar31.003933.1483@mintaka.lcs.mit.edu> <18ee3f47.ARN125e@jsmami.UUCP> Organization: Not an Organization Lines: 73 In article <18ee3f47.ARN125e@jsmami.UUCP> jsmoller@jsmami.UUCP (Jesper Steen Moller) writes: >In article , Mike Schwartz writes: >>... >> How many LINK, UNLK instructions do I unnecessarily have on my hard >> disk? How much for all the hard disks in the Amiga community alone? >> Terabytes? I often write programs that need to fit in small machines, >> so I'd rather save tens of thousands of bytes in a (> 100K) program. > >Some are LINK/UNLK are waste. Some are there because of a source that >is modulized and easy to maintain so that you will receive a new version >some day. Neither DICE nor Manx nor SAS/C generate LINK/UNLK instructions unless they have to, and the next major release of SAS/C will do away with them entirely. Similar optimizations -- passing args in registers for example, have existed for several years. as far as switch() statements go, an optimizing C compiler has the advantage of being able to generate extremely fast code for large switches, either by using a jump table (which an assembly programmer would use anyway) OR, for *really* sparse switches, a log N time comparison tree perhaps using jump tables when the sparseness becomes reasonable. >> Why is the best compiler on the Amiga run the bejeezes slow? > >It's good at optimizing, and that takes time. And, it wasn't written >by Matt (unless you do mean DICE of course...) so it might have >some inefficient algorithms in it... :-) >> when it is basic programming normally done by assembler language >> programmers (one of the oldest tricks in the book)? > >Because, if you were to code e.g. a file requester, and you >had > VISIBLE_FSEL_LINES EQU 17 ; or whatever > >and you'd do a > MULU.L #VISIBLE_FSEL_LINES,d0 >one day, you'd forget this. Using a define here is good, and any day now >it might be changed to 37, when recompiling for interlace (or whatever). >That is (my humble guess) why we ask. That's an excellent answer that I missed in my earlier reply to the message... the moment you hand optimize a constant operation you loose the flexability of the constant. >> Come on people, no flames for this, these are serious questions. > >You got no flames, and serious answers. > >> **************************************************** >> * I want games that look like Shadow of the Beast * >> * but play like Leisure Suit Larry. * >> **************************************************** > >Jesper Steen Moller /// VOICE: +45 31 62 46 45 >Maglemosevej 52 __ /// USENET: cbmehq!cbmdeo!jsmoller >DK-2920 Charl \\\/// FIDONET: 2:231/84.45 >Denmark \XX/ -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA