Compiler Performance

Sun claims their Sun Studio 12 compiler performs well on SPEC (Free Compiler Wins Nehalem Race by 2x). So I compared PHP 5.3.1 running PHPspeed 1.0 beta (using “Real World PHP Benchmark”) and xcache 1.3.0, compiled with Sun Studio 12, GCC 4.4.1, and Intel C Compiler 11.1.064.

System

  • Mandriva 2010.0 x86_64 kernel 2.6.31.6-server-1mnb, Core 2 Duo 3.6 GHz, EIST temporarily disabled
  • Apache 2.2.14-1.2mdv2010.0
  • mysql 5.1.41 compiled with icc
  • php 5.3.1 and xcache 1.3.0, compiled with the same compiler flags.

PHP 5.3.1

'--with-apxs2=/usr/sbin/apxs' \
'--enable-force-cgi-redirect' \
'--disable-all' \
'--with-gd' \
'--with-mysql=/usr/local/mysql' \
'--with-mysqli' \
'--with-pdo-mysql' \
'--enable-xml' \
'--with-pear' \
'--enable-shared' \
'--disable-static' \
'--with-gnu-ld' \
'--with-zlib' \
'--enable-libxml' \
'--with-libxml-dir' \
'--enable-ftp' \
'--with-gettext' \
'--with-openssl' \
'--with-pcre-regex' \
'--enable-session' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--with-imap' \
'--with-imap-ssl' \
'--enable-inline-optimization' \
'--enable-magic-quotes' \
'--with-regex=php' \
'--with-jpeg-dir=' \
'--with-png-dir' \
'--with-zlib-dir' \
'--with-xpm-dir' \
'--enable-tokenizer' \
'--enable-mbstring' \
'--enable-json' \
'--enable-zend-multibyte' \
'--with-zend-vm=GOTO' \
'--enable-pdo' \
'--with-pdo-mysql=/usr/local/mysql'

Sun Studio 12 Update 1

CFLAGS=’-xO5 -xchip=penryn -xcache=32/64/8:6144/64/24 -xarch=sse4_1 -xdepend=yes -fsimple=2 -fns=yes -ftrap=%none -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -nofstore -xregs=frameptr -fpic -m64 -xvector=simd -xipo=2′

libtool needed editing after running configure to set wl=”" to wl=”-Wl,”. configure doesn’t seem to correctly detect that -Wl, is needed to pass linker flags to the compiler.

Intel C Compiler 11.1.064

CFLAGS=’-xHOST -O3 -no-prec-div -static-intel -static-libgcc -funroll-loops -fomit-frame-pointer’

Using -ipo results in a functional libphp5.so, but seems to break modules (e.g. xcache) due to missing symbols.

GCC 4.4.1

CFLAGS=’-O3 -march=core2 -mfpmath=sse -msse4.1 -funroll-loops -fomit-frame-pointer’

Performance using PHPspeed 1.0 beta

PHPspeed 1.0 beta’s “Real World PHP Benchmark” was run many times for each setup, and the maximum score reported. This benchmark measures the performance of PHP, and by varying only the compiler, I can measure the quality of the compiler output when compiling PHP.

  • Sun Studio 12: 10247
  • GCC 4.4.1: 14750
  • ICC 11.1: 15557

GCC is reasonably competitive with ICC. Sun Studio 12 is very far behind, despite being the only compiler with IPO enabled. Disappointing.

m4s0n501

Comments are closed.