This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/19642] streaming doubles is very slow compared to sprintf
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jan 2005 15:37:33 -0000
- Subject: [Bug libstdc++/19642] streaming doubles is very slow compared to sprintf
- References: <20050126142651.19642.joerg.richter@pdv-fs.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pcarlini at suse dot de 2005-01-26 15:37 -------
For reference, on linux, a typical profile (count = 10000000) begins as
follows, and:
1- The various snprintf are on top.
2- uselocale (the thread safe equivalent of setlocale) is way below
Therefore, we can easily guess that the performance are not so different
from those of snprintf alone.
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
28.65 5.71 5.71 __printf_fp
13.50 8.40 2.69 __mpn_divrem
7.28 9.85 1.45 memcpy
6.62 11.17 1.32 buffered_vfprintf
5.67 12.30 1.13 vfprintf
5.22 13.34 1.04 __mpn_mul_1
2.51 13.84 0.50 mempcpy
2.31 14.30 0.46
std::ostream::operator<<(double)
2.21 14.74 0.44 __mpn_rshift
2.01 15.14 0.40
std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char,
std::ostreambuf_iterator<char, std::char_traits<char> >
>::_M_insert_float<double>(std::ostreambuf_iterator<char, std::char_traits<char>
>, std::ios_base&, char, char, double) const
2.01 15.54 0.40 isinf
1.81 15.90 0.36 isnan
1.46 16.19 0.29 std::basic_filebuf<char,
std::char_traits<char> >::xsputn(char const*, int)
1.30 16.45 0.26 __mpn_extract_double
1.30 16.71 0.26 uselocale
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19642