This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: complex performance
- To: nbecker <nbecker at fred dot net>
- Subject: Re: complex performance
- From: Thomas Kunert <kunert at physik dot tu-dresden dot de>
- Date: Fri, 15 Jan 1999 19:26:28 +0100
- Cc: egcs at cygnus dot com
- Organization: TU Dresden
- References: <E100oTs-0000tC-00@hns.com>
nbecker wrote:
>
> While I'm bitching about performance, one of the worst offenses is:
>
> complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { }
>
> This means that every time this comes into scope:
>
> complex<double> array[BIG]
>
> we waste possibly large amounts of time initializing the array with
> zero values. I think this is very unfortunate.
The c++-standard describes a class template `allocator'. This is able to
allocate space for an array of whatever type you want without
initializing it.
Another way to avoid this problem is using a static array.
Thomas