I was talking to some people at the Intel booth at Linux World Expo
yesterday about their compiler, and decided to try it out on Perl. I
have some results below, but first some caveats:
- perlbench is not a very good measure of how web applications will
perform. It tends to be weighted towards math functions.
- If your application is spending most of its time doing I/O (i.e.
reading from a database), this will probably not help you. Most
mod_perl apps are I/O bound, waiting for databases.
- I don't know anything about compiler flags. I just used the ones that
Intel used in their comparison.
- There were two test failures on the Perl compiled with Intel's
compiler. I don't know yet if these are serious.
So, with all that out of the way, perlbench showed about a 4%
improvement using "aggressive" optimization flags with gcc, and Intel's
compiler got about 8% above that, or 12% better than Perl compiled with
defaults for Linux. The details are attached. Note that my baseline
Perl, compiled with all Linux defaults, still beats the one that ships
with Red Hat 9 by about 20%.
If I get ambitious, I might try compiling enough pieces with icc to run
one of Josh's templating benchmarks.
- Perrin
A) perl-5.008001
path = /usr/local/perl581/bin/perl
cc = cc
optimize = -O3
ccflags = -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
usemymalloc = n
B) perl-5.008001
path = /usr/local/perl581_icc/bin/perl
cc = icc
optimize = -O3
ccflags = -we147 -xW -tpp7 -ipo -ipo_obj -fno-strict-aliasing
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
usemymalloc = n
C) perl-5.008001
path = /usr/local/perl581_gcc_agg/bin/perl
cc = cc
optimize = -O3
ccflags = -ffast-math -funroll-all-loops -fomit-frame-pointer
-march=pentium4 -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
usemymalloc = n
A B C
---- ---- ----
arith/mixed 100 115 90
arith/trig 100 146 106
array/copy 100 98 99
array/foreach 100 113 139
array/index 100 109 93
array/pop 100 106 99
array/shift 100 107 97
array/sort-num 100 100 100
array/sort 100 140 108
call/0arg 100 102 93
call/1arg 100 116 117
call/2arg 100 98 83
call/9arg 100 121 99
call/empty 100 95 70
call/fib 100 102 97
call/method 100 101 97
call/wantarray 100 106 98
hash/copy 100 125 108
hash/each 100 119 95
hash/foreach-sort 100 131 101
hash/foreach 100 123 103
hash/get 100 108 89
hash/set 100 134 94
loop/for-c 100 99 83
loop/for-range-const 100 123 98
loop/for-range 100 124 103
loop/getline 100 130 113
loop/while-my 100 120 162
loop/while 100 124 127
re/const 100 98 104
re/w 100 124 111
startup/fewmod 100 101 104
startup/lotsofsub 100 110 107
startup/noprog 100 54 99
string/base64 100 110 107
string/htmlparser 100 112 99
string/index-const 100 110 83
string/index-var 100 112 90
string/ipol 100 106 89
string/tr 100 120 120
AVERAGE 100 112 102
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html