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


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

Re: complex performance


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


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