Do you have a favorite program, that seems sluggish on your machine? A possible explanation is the packager (or the source itself) didn't use all of the optimization options possible when compiling the program. This is orriented towards the average "joe" PowerPC Linux user, so you don't need any kind of special programming knowledge.

There are certainly good reasons why you might not want to use these options when packaging a program for use by others, or when debugging, but for average day to day use, it shouldn't matter to you. I'll explain the risks and benfits of each option.

Howto Add Flags

Editing the Makefile

You will need to edit Makefile.in, which is the file that sets up the template for the actual Makefile, to be generated in every directory of the program's source when you run ./configure

Go to the line you want to change.

For C++ programs, you need to add your desired flags to:

  • CXXFLAGS
  • CPPFLAGS

    (CXXFLAGS are for additional C++ Flags, CPPFLAGS are for additional C++ Preprocessor flags)

    For C programs, you need to add your desired flags to:

  • CFLAGS

    In some cases, programs will have both C and C++ code in them (you will see both CXXFLAGS and the CPPFLAGS option), you can safely fill both of them in.

    Example:

    CXXFLAGS= -03 -fno-exceptions
    CFLAGS= -03 -fno-exceptions

    Without Editing Makefile.in

    In most cases you don't even have to edit the Makefile. You can also just specify flags as a variable in bash. Just make sure to put it in a single quotes, to avoid confusing bash.

    Example:

    CXXFLAGS='-03 -fno-exceptions'

    Optimization Flags

    Below I'll Explain the Most Common Flags:

    -O0 - No Optimization, Totally Generic. It's slow, but easy to debug, and should be reliable between processors. Fast to compile, requires little memory to compile

    -O1 - A little bit of optimization. Should work between processors.

    -O2 - This is the default of many programs. It may not be completely compatible between processors. It does "nearly all" optimizations that don't mean an increase of binary size. This is probably the best for most programs, that you are compiling for yourself.

    -O3 - Optimize as much as possible. It enables all possible optimizations, including inline-functions. This may generate binaries not compatible with all PPCs. It will create slightly larger binaries to, and should only be used where speed is very important.

    -fno-exceptions - Disable all exceptions handling. Most programs don't need exception handling enabled, disabling will greatly decrease disk size and memory use, and increase speed. For example, compiling Qt with -fno-exceptions, will cut binary size in half, and make KDE programs launch and run much faster. This is also true for other programs.

    I'm looking for reports of success, other flags, etc. that can make PowerPC Linux run programs faster. Send them to .

    References: