[Bug c++/26788] optimization of expression templates not as performant as g++ 4.0.2

roebel at ircam dot fr gcc-bugzilla@gcc.gnu.org
Wed Mar 22 11:13:00 GMT 2006



------- Comment #5 from roebel at ircam dot fr  2006-03-22 11:13 -------
Created an attachment (id=11090)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11090&action=view)
Results file for testcase

As you requested I provide a testcase. It consists of 2 shell scripts
that run the different compilers and then run the testcase.
The testcase has two cases and two compilation modes:

switch 1
compiled with -DHAND it gives hand optimized pointer only version
compiled with -DMATMTL it gives the equivalent expression templates version
switch 2
compiled with -DBENCH=1 it calculates an addition of three vectors
compiled with -DBENCH=2 it calculates an addition of three vectors with some
scalar multiplications

The name of the excutable will indicate the experiment by two final characters
H1 stands for hand optimized first benchmark, M2 stands for matmtl second
benchmark ...

The two scripts comp.sh and master.sh run the whole experiment:
comp.sh runs the experiment for a single compiler and a user supplied set of 
vector sizes. Note, that each experiment always uses 100000000
vector element operations. By means of the vector size the amount of overhead
can be controlled.
master.sh runs comp.sh with a single compiler and the vector size arguments 5
and 1000

Results are produced with

./master.sh 2>&1 | tee mout
egrep "#|user"  mout

First result is that gcc 4.1.0 with --param  salias-max-implicit-fields=50
is a real success. As you see the compile time does not change "at least for
this testcase" but the performance is identical to the pointer only
case!!!!!!!!!!!!!!!!!!!!

second result is that for gcc 4.1.0 with default parameter set
we get performance worse then gcc 4.0.2 especially for small vectors
(large overhead). The larger the vectors become the more
gcc 4.1.0 approaches 4.0.2

###############################################################
# g++ 4.0.2 the reference
###################################################
#compile times
user    0m0.702s
user    0m0.697s
user    0m1.066s
user    0m1.077s
#run times : vector size 5
# benchmarkredH1
user    0m0.295s
# benchmarkredM1
user    0m0.307s
# benchmarkredH2
user    0m0.381s
# benchmarkredM2
user    0m0.412s
#run times : vector size 1000
# benchmarkredH1
user    0m0.230s
# benchmarkredM1
user    0m0.243s
# benchmarkredH2
user    0m0.287s
# benchmarkredM2
user    0m0.370s
# g++ 4.1.0 default
###################################################
#compile times
user    0m0.747s
user    0m0.752s
user    0m1.211s
user    0m1.227s
#run times : vector size 5
# benchmarkredH1
user    0m0.264s
# benchmarkredM1
user    0m0.519s
# benchmarkredH2
user    0m0.347s
# benchmarkredM2
user    0m1.211s
#run times : vector size 1000
# benchmarkredH1
user    0m0.222s
# benchmarkredM1
user    0m0.286s
# benchmarkredH2
user    0m0.298s
# benchmarkredM2
user    0m0.375s
# g++ 4.1.0 salias=50
###################################################
#compile times
user    0m0.753s
user    0m0.741s
user    0m1.225s
user    0m1.239s
#run times : vector size 5
# benchmarkredH1
user    0m0.262s
# benchmarkredM1
user    0m0.307s
# benchmarkredH2
user    0m0.344s
# benchmarkredM2
user    0m0.313s
#run times : vector size 1000
# benchmarkredH1
user    0m0.223s
# benchmarkredM1
user    0m0.234s
# benchmarkredH2
user    0m0.299s
# benchmarkredM2
user    0m0.260s


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26788



More information about the Gcc-bugs mailing list