This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
a note on std::complex performance
- To: libstdc++ at sources dot redhat dot com
- Subject: a note on std::complex performance
- From: Gerhard Wesp <gwesp at cosy dot sbg dot ac dot at>
- Date: Fri, 21 Sep 2001 13:41:35 +0200
- Cc: g at localhost
- Reply-To: gwesp at cosy dot sbg dot ac dot at
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