Blitz logo

Blitz Devel :

From: Todd Veldhuizen (tveldhui_at_[hidden])
Date: 1998-07-13 16:33:25


I'm now back at work on blitz (I was away for the past 2 weeks).
Today I was looking at Hao He's complex<double> example. I've
added a new benchmark for this, called benchmarks/hao-he.cpp.

The kernel is a simple one, just
b += a*a

where a and b are arrays of complex<double>. Under egcs the
array versions are twice as slow as if you write the loop
manually:

egcs, i686-pc-linux-gnu
Time using array notation b += a*a: 2.46
Time using array notation b += sqr(a): 2.69
Time using low-level version: 1.29
Time using really low-level version: 1.11

These times are in seconds.

First results seem to indicate that this is compiler-related.
The KAI compiler gives much better results:

KAI C++, powerpc-ibm-aix4.2.0.0
Time using array notation b += a*a: 4.72
Time using array notation b += sqr(a): 4.57
Time using low-level version: 4.26
Time using really low-level version: 4.55

Here the array versions are only 10% slower. This is still
bad, but not unacceptable.

Offhand I'm guessing that the egcs compiler doesn't optimize
away the temporary complex<double> objects. I'll look into
this in more detail.

Cheers,
Todd

--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: mail to majordomo_at_[hidden], with
"subscribe blitz-dev" or "unsubscribe blitz-dev" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/