start page | rating of books | rating of authors | reviews | copyrights

Practical mod_perlPractical mod_perlSearch this book

15.5. Architecture-Specific Compile Options

When you build Apache and Perl, you can optimize the compiled applications to take advantage of the benefits of your machine's architecture.

Everything depends on the kind of compiler that you use, the kind of CPU(s) you use, and your OS.

For example, if you use gcc(1), you might want to use -march=pentium if you have a Pentium CPU, or -march=pentiumpro for PentiumPro and above.

-fomit-frame-pointer makes an extra register available but disables debugging. You can also try these options, which have been reported to improve performance: -ffast-math, -malign-double, -funroll-all-loops, -fno-rtti, and -fno-exceptions. See the gcc(1) manpage for details about these.

You may also want to change the default -O2 flag to a flag with a higher number, such as -O3. -OX (where X is a number between 1 and 6) defines a collection of various optimization flags; the higher the number, the more flags are bundled. The gcc manpage will tell you what flags are used for each number. Test your applications thoroughly (and run the Perl test suite!) when you change the default optimization flags, especially when you go beyond -O2. It's possible that the optimization will make the code work incorrectly and/or cause segmentation faults.

See your preferred compiler's manpage and the resources listed in the next section for detailed information about optimization.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.