oopack performance

Dan Nicolaescu dann@ics.uci.edu
Tue May 6 13:29:00 GMT 2003


Mainline GCC performs well for the 3 of the 4 oopack benchmarks. 
The only exception is "Complex". 

On a 1.3GHz Athlon:

g++ -O3 oopack.C -o oopack
./oopack Max=100000 Matrix=1000 Complex=100000 Iterator=100000

                         Seconds       Mflops         
Test       Iterations     C    OOP     C    OOP  Ratio
----       ----------  -----------  -----------  -----
Max            100000    0.6   0.6  158.7 156.2    1.0
Matrix           1000    0.4   0.4  568.2 568.2    1.0
Complex        100000    0.9  10.0  930.2  79.7   11.7
                              ^^^^  
Iterator       100000    0.3   0.3  645.2 625.0    1.0


The performance can be improved dramatically by just adding a
constructor to the "Complex" class:

Complex (const Complex &F) : re(F.re), im(F.im) {}

./oopack-constructor Max=100000 Matrix=1000 Complex=100000 Iterator=100000

                         Seconds       Mflops         
Test       Iterations     C    OOP     C    OOP  Ratio
----       ----------  -----------  -----------  -----
[snip]
Complex        100000    0.9   1.5  909.1 522.9    1.7
                               ^^^^


That is a ~7X performance increase. 

Any idea why is this happening? 

Oopack can be downloaded from: 
http://www.ratol.fi/~sfarin/cpp-bench/oopack_v1p8.C



More information about the Gcc mailing list