As previously discussed on Linux Magazine, Gentoo is a source based distribution which lets the end user decide what their system will be.
All binary distributions make these choices for you, but building from source, Gentoo users can decide for themselves. They are able to choose what CPU their binaries will be built for, as well as GCC optimizations.
Taken directly from the GNU GCC Manual:
“Without any optimization option, the compiler’s goal is to reduce the cost of compilation and to make debugging produce the expected results… Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program.
The compiler performs optimization based on the knowledge it has of the program. Compiling multiple files at once to a single output file mode allows the compiler to use information gained from all of the files when compiling each of them.”
The -O1 option begins the optimization, with -O2 and -O3 optimizing further. The special -Os option optimizes code for size. It enables all the options from -O2 which do not increase the size of the code and is especially useful for low-memory systems. Today Linux Magazine benchmarks three of the most common, -Os, -O2 and -O3.
The computer system used in these tests is an Intel Core2 CPU, and as such Gentoo was compiled in 64bit with the “-march=core2″ CPU type. Ubuntu is included for comparison purposes. Jaunty Jackalope 9.04 was chosen because it is the current stable version and more closely matches the Gentoo system, with the exception of the kernel which is two versions behind. Each installed system is just the base with any required dependencies for testing, plus XOrg and Xfce4.
The Hardware
Processor: Intel Core 2 Duo CPU E8400 @ 3.00GHz (Total Cores: 2) Intel SpeedStep Technology enabled
Motherboard: Gigabyte EP35-DS3P
Chipset: Intel 82G33/G31/P35/P31 + ICH9R
System Memory: 3965MB
Disk: 300GB ST3300831AS
Graphics: GeForce 8800 GT
Monitor: Samsung SyncMaster
Gentoo System
The Gentoo system was built from the stable branch using the same USE flags and packages. For each of the different GCC optimization levels, the system’s tool chain was re-built, then the entire system was rebuilt, twice. All systems used the same kernel configuration and packages.
Kernel: 2.6.30-gentoo-r5 (x86_64)
Desktop: Xfce 4.6.1
Display Server: X.Org Server 1.5.3
OpenGL: 3.0.0 NVIDIA 180.60
Compiler: GCC 4.3.3
Java: Sun Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
File-System: ext3
Screen Resolution: 1280x1024
The make profile used was amd64/2008.0 with the following additional USE flags set:
custom-cflags custom-optimizations qt3support X sse sse2
Ubuntu System
The Ubuntu system is very similar in terms of software, with the exception of an older kernel and newer version of X.Org.
Kernel: 2.6.28-15-generic (x86_64)
Display Server: X.Org Server 1.6.0
OpenGL: 3.0.0 NVIDIA 180.44
Compiler: GCC 4.3.3
Jave: Sun Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
File-System: ext3
Screen Resolution: 1280x1024
Let The Games Begin!
The benchmarking system used is Phoronix Test Suite, which is widely regarded as the most complete benchmarking tool for Unix systems. The tests themselves are broken down into categories. Low level hardware tests such as memory and disk benchmarking have been excluded as they are effectively the same.
Audio Visual
This first set of results shows the conversion of an audio file into several different formats, including FLAC, Monkey Audio, MP3, OGG Vorbis and Wavpack.





When encoding a file, there was not much difference between GCC optimizations, and Ubuntu also performed similarly.

Mencoder converts a video file between two formats and here while -O3 has an ever so slight advantage, the biggest surprise is Ubuntu which takes almost twice as long as Gentoo.


When it comes to playing back video, each Gentoo system performed on par while Ubuntu used slightly more CPU resources.