From: G DOT DegliEsposti AT ads DOT it To: conserv3 AT infi DOT net cc: djgpp AT delorie DOT com Message-ID: Date: Fri, 3 Apr 1998 12:58:39 +0200 Subject: Re: ! Optimization in Practice Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Precedence: bulk >I understand that Optimization produces code that the debugger has >problems with for various reasons but, if -O3 produces such fast This is not completely true: gdb can debug programs compiled with optimization options. IIRC some problems can come up when the optimizer swaps the order of some instructions and you can get confused because it seems like some instruction are skipped, while they are only executed in a different order. >results, why not use it all the time? Why would I choose -O1 or -O2 >over -O3? I don't have the docs here now so I can write by my own memory: IIRC, the -O3 level implies some space/time tradeoffs, trying to reduce the execution time using methods thet increase the space occupied by the programs (inlining functions, unrolling loops, ...) Sometimes this can have the opposite effect, because if the amount of code you get is too much then at run time it can overflow the cpu code cache, lowering the execution speed. If this can explain why use -O2 in stead of -O3, I agree with you on one point: why -O1 in stead of -O2 ? Maybe the switch is available for backward compatibility ? ciao Giacomo