PHP / GCC / ICC Benchmark

Last month I got a bit bored and built PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and current PHP_5_2 (the last two each with CALL, GOTO, and SWITCH VMs) with GCC 3.4.6 and GCC 4.1.1 with -O{0|1|2|3|s}. Yes, this means I built 80 PHP binaries. No, I did not do this manually.

Below are the results of running bench.php with each of the binaries that I built.

PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and PHP 5.2 built with GCC 3.4.6 and CFLAGS='-O{0|1|2|3|s}'

As you can see, PHP 5.1 and PHP 5.2 are both around three times faster than PHP 4.4 and PHP 5.0 (GCC 3.4.6, -O2).

PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and PHP 5.2 built with GCC 4.1.1 and CFLAGS='-O{0|1|2|3|s}'

Each binary ran the benchmark script five times, the numbers shown are the respective mean from the five runs.

The numbers for PHP 5.1.6 and PHP 5.2 are based upon the CALL-based virtual machine as GOTO and SWITCH did not work for most of the optimization levels.

Update: Yesterday I built PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and PHP 5.2.0 with ICC 9.1.042 using -O{0|1|2|3|s} and -fast.

PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and PHP 5.2.0 built with ICC 9.1.042 and CFLAGS='-O{0|1|2|3|s}' and CFLAGS='-fast'Below is a chart that directly compares GCC 3.4.6, GCC 4.1.1, and ICC 9.1.042.

GCC 3.4.6 vs GCC 4.1.1 vs ICC 9.1.042 for PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and PHP 5.2.0

The GCC versions used were Gentoo sys-devel/gcc-4.1.1-r1 and Gentoo sys-devel/gcc-3.4.6-r2 together with Gentoo sys-devel/binutils-2.17.

The CFLAGS used for GCC were "-march=pentium-m -msse3 -O{0|1|2|3|s} -pipe".

The configure options used were "--disable-all --disable-cgi".

The extended body of this posting contains the raw test results as well as detailed information on the hardware used to run the benchmarks.