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]
Other format: [Raw text]

Re: [PATCH, libstdc++, complex] complex multiplication algorithm improved


Hi,
> Paolo, I tested the patch with this program :
>
> #include <complex>
> #include <iostream>
> #include <ctime>
>
> using namespace std;
>
> int main()
> {
>     unsigned long long l = clock();
>
>     complex<long long> a;
>
>     a.real() = l & 0xFFFFFFFF;
>     a.imag() = l & 0xFFFFFFFF0000;
>     a.imag() >>= 32;
>
>     unsigned long long i = clock();
>     for ( unsigned long i = 1; i < 1000000000; ++i )
>         a *= a;
>     unsigned long long j = clock();
>
>     cout << "\nclocks: " << j - i << endl;
>     cout << a;
>
>     return 0;
> }
>   
Ok, now at least we have some concrete details. Because, normally, if I
see a performance-related std::complex patch I expect the submitter is
addressing float / double / long double, how can I guess long long?
> the one compiled with the patched <complex> outputs 34930000, while
> the one with old <complex> outputs 37430000.
>   
Interesting. Note, however, that all in all the difference seems rather
small, and Marc Glisse for example clarified that it all depends on the
actual type you are instantiating with (besides the machine). Since we
are talking about the primary template you really have no idea which
type you are dealing with. Personally, unless Gaby Dos Reis, the primary
maintainer of <complex>, gives me a strong direction, I don't think we
should do anything here.

Paolo.


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