From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Compile extensions Date: Thu, 16 Jan 1997 19:05:04 -0800 Organization: Two pounds of chaos and a pinch of salt Lines: 28 Message-ID: <32DEEC60.2F98@cs.com> References: <01bc03eb$6be81120$492449c2 AT default> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp106.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Thomas Harte wrote: > > Which extensions to the regular GCC command line do you all recommend to > use when compiling for speed over size. My programs use a lot of fixed > point maths, and some occasional floating point, and use both the Allegro > and SB_LIB libraries. Look into the gcc docs for Optimization Flags. In general, you want to use one of -O, -O2, or -O3, with each level attempting to achieve a higher speed-size tradeoff. Generally, -O2 is the best overall choice, giving you maximum speed for very little increase in size, and sometimes even a decrease! -O3 goes all out, inlining as much code as it can. This significantly bloats your program's size, but doesn't always improve speed to compensate. You can also specify various -f switches to directly control what optimizations are and aren't used. A word of advice: Definitely read all of chapter 14 of the FAQ; it contains some excellent tips on speed and optimization. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | God's final message to His Creation: | http://www.cs.com/fighteer | | "We apologize for the inconvenience."| Fight against proprietary | | - Douglas Adams | software - support the FSF!| ---------------------------------------------------------------------