I did some benchmarking of PHP compiled with gcc 4.0.1. Results and methodology are described at:
http://wp.wikidev.net/GCC_benchmarking
I eventually settled on -O3 with profile-guided optimisation. This gave a 5-10% improvement over the old PHP 4.3.11 build on all the benchmarks except preg_replace. The preg_replace problem is probably because the benchmark was atypical compared to the profiling data, which was gathered using refreshLinks.php.
-- Tim Starling
If you're going to install a new build of php on the wikimedia servers I'd like to remind you of bug 2741, build php with Exif support (--enable-exif).
wikitech-l@lists.wikimedia.org