This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: RFC: fp printing speedup patch
Paolo Carlini writes:
> Hi Jerry. I'm just back and still trying to catch up...
>
> Anyway, I have already printed the patch and was hoping to return
> to you tomorrow or at most on monday.
>
> Some things I can tell you immediately:
[snip]
>
> 2- Some more numbers about performance: for sure it's a big
> improvement (thanks again) but which is still the gap wrt v2
> for some interesting examples (big number of digits/small
> number of digits)
On numbers that are handled by the bigint code, floatconv is not too
fast. On the following test, I get:
real 0m9.812s
user 0m9.790s
sys 0m0.010s
as opposed to ~2.8 seconds when the fast path is used for relatively
small amounts of precision. For reference, I get from gcc-2.95:
real 0m8.392s
user 0m8.360s
sys 0m0.000s
and gcc-3.3
real 0m25.976s
user 0m25.910s
sys 0m0.010s
Jerry
#include <iostream>
#include <iomanip>
int main()
{
for (int i = 0; i < 3000000; i++) {
std::cout << std::setprecision(30)
<< (double)i + 9.09923452563465256292345256346525629234525634652562e+18 << '\n';
}
return 0;
}