Securing and Optimizing Linux:RedHat Edition | All about OS

General System Optimization

Категория: Securing and Optimizing

• The “-fforce-mem”
The “-fforce-mem” optimization option will produce better code by forcing memory operands to be copied into registers before doing arithmetic on them and by making all memory references potential common subexpressions.
The “-fforce-addr”
The “-fforce-addr” optimization option will produce better code by forcing memory address constants to be copied into registers before doing arithmetic on them.
• The “-fomit-frame-pointer”
The “-fomit-frame-pointer” optimization option, one of the most interesting, will allow the program to not keep the frame pointer in a register for functions that don’t need one. This avoids the instructions to save, set up and restores frame pointers; it also makes an extra register available in many functions and makes debugging impossible on most machines.
IMPORTANT NOTE: All future optimizations that we will describe in this book refer by default to a Pentium ll/lll CPU family. So you must, if required, adjust the compilation flags for your specific CPU processor type in the “/etc/profile” file and also during your compilation time.
Benchmark Results Summaries by Architecture
Depending on your processor architecture and the version of your compiler (GCC/EGCS), optimization results may vary. The charts below will help you to choose the best compilation flags for your compiler/CPU architecture.
The compiler version installed on your Red Hat Linux version 6.1 and 6.2 is egcs 2.91.66, but be sure to check it even so before choosing your compiler optimization options.
• To verify the compiler version installed on your system, use the command: [root@deep /]# egcs -version egcs-2.91.66
NOTE: All benchmark results, and future results, can be retrieved from the GCC home page at the following address: http://egcs.cvanus.com/
Now as an example :
Fora Pentium ll/lll CPU (i686) with compiler version egcs-2.91.66, the best optimization options would be: CFLAGS=’-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions’
For a Pentium CPU (i586) with compiler version egcs-2.91.66, the best optimization options would be: CFLAGS=’-O3 -march=pentium -mcpu=pentium -ffast-matn -funroll-loops -fomit-frame-pointer -fforce-mem -fforce-addr -malign-double -fno-exceptions’For a i486 CPU with compiler version egcs-2.91.66, the best optimization options would be: CFLAGS=’-O3 -funroll-all-loops -malign-double -mcpu=i486 -march=i486 -fomit-frame-pointer -fno-exceptions’

Страниц: 1 2 3

« Unusual or hidden files
The “bdflush” parameters »