Compiler optimizations

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
Ambox outdated content.svg

This page is kept for historical interest. Its content is outdated or may be wrong.

You may find more up-to-date information on the website.

MediaWiki logo

I know it is time-consuming and often error prone, but have we considered compiling Apache, PHP and MySQL, and the Linux kernel with the appropriate gcc optimizations? Or do we want to stick with the vendor provided software? Assuming that we still are using the vendor provided packages, and that the CPUs are Athlon MPs, some options to consider might be: -mcpu=athlon-mp -march=athlon-mp -O3. We could see a speed-up of a good 10%, possibly more, considering the complexity of the code.

Mysql discourages the use of compilers newer than gcc 2.95; I don't know how well it supports what optimizations. Our present mysql was apparently compiled with CXXFLAGS = -O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti
  • "gcc >= 2.95.2, egcs >= 1.0.2 or egcs 2.91.66". <-- Listed requirements.

Looks like gcc 3.2.x should be fine. Recommended compiler options are

  • "CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"

I think we could change this to

  • CFLAGS="-O3 -march=athlon-mp -mcpu=athlon-mp" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti -march=athlon-mp -mcpu=athlon-mp"

I don't think any special optimizations were given for Apache or PHP.

The kernel I think is a stock Red Hat SMP kernel. We should probably upgrade it to a more recent 2.4 release anyway... --Brion VIBBER 18:13 21 Mar 2003 (UTC)

Definitely - I'd be willing to help out, if you like. I would probably stay with a stock kernel; messing with kernel options can be a mess, but if we need to eek out just a little bit more performance, it is another option available to us.