This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

a note on std::complex performance


hi!

i noted that, under certain circumstances, std::complex (with gcc-3.0.0)
is by a factor of 2-3 slower than with stlport.  my application is
simply the mandelbrot iteration, whose inner loop is

while( abs_squared( z ) <= max ) z = z * z + c ;

i looked at the implementation in libstdc++ and found that std::complex
is explicitly specialized for the floating point types and uses the
builtin complex type of gcc.  stlport does no such thing, and uses
simple inline functions for the operations.

my guess is that with stlport, the compiler can do much better
optimizations (reuse of common subexpressions) because it sees the
definition of the operations.  when using the builtin complex type, it
probably just generates library calls.

comments?

please cc replies to my email-address, i'm not on the list!

regards,
-gerhard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]