State of C99 _Complex?
Scott Robert Ladd
coyote@coyotegulch.com
Mon May 19 19:04:00 GMT 2003
My experiments suggest that GCC 3.3 generates slow code when it comes to
implementing the C99 _Complex types on the Pentium 4.
I'm not sure if the problem is in my use of gcc (i.e., I missed a subtle
compile-time switch), or if _Complex support is simply "weak" at this point.
I've tried several complex-dependent applications, and all have
performed slowly when compiled with gcc 3.3.
A case in point involves multiplication and addition of double-precision
complex numbers. The C version of the code, using double complex, runs
in 630 seconds, while the C++ version of the code, using complex<double>
runs in 285 seconds.
In other words: The intrinsic C types are twice as slow as the C++
template implementation. And that just doesn't seem *right*. ;)
The performance characteristics appear to be constant across different
sets of compiler switches. I've used a number of different options
(-mfpmath=sse, -mfpmath=387, ffast-math, etc.), to no avail; gcc's
complex code is just very, very slow.
I suppose I should try a Fortran 77 program, to see if g77 suffers from
the same problem.
Is this a known issue?
I can dig in deeper into the assembler output if no one else has a
handle on this.
--
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
More information about the Gcc
mailing list