Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!rutgers!cbmvax!cbmehq!cbmger!amiux!holgerl From: holgerl@amiux.UUCP (Holger Lubitz) Newsgroups: comp.sys.amiga.programmer Subject: Re: Lemmings - a tutorial Part V (last) Message-ID: Date: 1 Apr 91 18:54:51 GMT References: <781@tnc.UUCP> <1991Mar31.003933.1483@mintaka.lcs.mit.edu> Organization: Teuwag Lines: 36 In article mykes@amiga0.SF-Bay.ORG (Mike Schwartz) writes: >As far as 'C' goes, I have stepped through enough disassembled 'C' code to >see enough. How much RAM is wasted on LINK, UNLK instructions? How many >cycles are wasted by pushing arguments on the stack to call a subroutine? >How many cycles are wasted by calling a "glue" routine? How many cycles >and bytes are wasted by fixing up the stack after each and every subroutine >returns? How much stack do you need to allow for all the dynamic allocation >of local variables? What kind of disassembled 'C' code did you step through ? I suppose it was Greenhills C or some other ancient compiler. Optimized code from recent C compilers like SAS 5.10a doesn't do this, if you don't want it to. You can pass parameters through registers, eliminating the need to pass them via stack and also making glue routines obsolete. And dynamic allocation of local variables is nice to have as an aid in structured programming - however, it is not needed. You can program in C using only global variables and constants - just like you probably do when programming in assembler. Are you always checking how to do a multiplication the fastest way ? Any optimizing C compiler does (well, at least if you tell it to optimize for time instead of optimizing for space.) It won't use MULU #17,D0, instead it would copy D0 to D1, shift D0 by 4 bits, and add D1 to D0. Do you think the average assembler programmer does ? And by the way, Mike: Please try to strip down the quoted lines. It is a pain to read dozens of quoted lines once more just to ensure not missing the one or two lines where you comment on them. Best regards, Holger -- Holger Lubitz | holgerl@amiux.uucp Kl. Drakenburger Str. 24 | holgerl@amiux.han.de D-W-3070 Nienburg | cbmvax.commodore.com!cbmehq!cbmger!amiux!holgerl