From: quacci AT vera DOT com (jon) Newsgroups: comp.os.msdos.djgpp Subject: Re: Any tips on optimizing C code? Date: Fri, 23 May 1997 03:36:39 GMT Organization: Yale University Message-ID: <33850f40.4566839@news.cis.yale.edu> References: <33775c59 DOT 19219875 AT news DOT cis DOT yale DOT edu> <5l8nqq$f5e AT freenet-news DOT carleton DOT ca> NNTP-Posting-Host: slip-ppp-node-12.cs.yale.edu Lines: 34 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On 13 May 1997 03:40:10 GMT, ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) wrote: <...> >Compile with -m486, since anything speed-requiring should be run on 486 >and up nowadays. This causes gcc to optimize for 486 and up chips. Two things about this- firstly, since i am linking separately from my compile line, should I also link with a -m486? I've tried, and I get no complaints... but I also don't know what I'm asking the linker to do! Secondly, what are all the "alignment problems" I keep seeing flash by this newsgroup regarding something to do with -m486? I have notice a speed increase compiling with it, so this isn't really a key issue; it works in what I'm doing now nicely. <...> >A function >called frequently, especially recursively or in inner loops, can be >declared "register" I'd never thought of that- thanks! > and registers are used to pass parameters instead of >the stack. If the function has only two or three arguments, they all get >passed by register. This saves a lot of push and pop instructions, but it >might cause gcc to juggle registers instead, so test your program's speed >with and without this for each function. It of course does not affect >functions with no arguments. Great stuff. Thanks.