|performance gcc vs other compilers? firstname.lastname@example.org (Weihaw Chuang) (1996-03-29)|
|Re: performance gcc vs other compilers? email@example.com (1996-04-02)|
|Re: performance gcc vs other compilers? firstname.lastname@example.org (1996-04-06)|
|From:||email@example.com (John Carr)|
|Date:||6 Apr 1996 22:18:26 -0500|
|Organization:||Massachusetts Institute Of Technology|
Weihaw Chuang <firstname.lastname@example.org> wrote:
>I'm doing this project in my spare time to learn about compiler
>optimizations so if anyone can give me more pointers, I'd really
The basic rule: every compiler has some blind spots, even highly
optimizing compilers. One can always find code to make a compiler
Read the performance tuning section of the compiler manual and the
list of options. Usually each optimization level will have a list of
optimizations performed at that level. Sometimes the optimizations
will be described but more often they will just be listed by name.
Sometimes there are debugging flags to print information about
specific optimization passes. These flags are generally hard to find
out about. On UNIX you can run "strings" on the binary and look for
embedded text related to option processing; this may be a technical
violation of your license.
There are usually additional options beyond the basic -O1, -O2, etc.
Some of these enable specific optimizations in stanard code; others
declare that the source does not use certain features of applicable
standards. For example, that Sun's compiler allows one to declare
that pointer arguments to a function do not alias each other. The
existence of this option implies that Sun's compiler does some pointer
Try compiling the same source with and without certain options and
comparing the resulting machine code.
GNU C tends to be good at micro-optimizations. This is partially a
result of the way it is maintained. It is a lot easier to write a
small change to recognize an algebraic identity or an alternate form
of a short instruction sequence than it is to implement (for example)
global alias analysis. There are also complicated interactions among
components making certain types of changes difficult. GNU C is also
good at compiling itself and GNU emacs. gcc-compiled gcc is about 10%
faster than gcc compiled with Sun's compiler at high optimization.
John Carr (email@example.com)
Return to the
Search the comp.compilers archives again.