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]

ostringstream performance



The way I'm using ostringstream is very slow. The default performance is a
little better in 3.0.4 than 2.95.3
but not much. With 2.95.3 a hack constructing ostringstream with a large
constant string seems to make it
 much faster than the 3.0.4 version. In 2.95.3 it looks like the buffer grows
(and is copied) for every character.
With 3.0.4 the situation must have gotten a little better but the code is harder
to follow. My hack with the big
constant string no longer works. Is there a way to choose the size of the buffer
used by ostringstream?
Perhaps the way the buffer grows needs to be looked at further?

Here is the source I'm using to performance check this. Admittedly I'm comparing
ostringstream with
sprintf - but if ostringstream doesn't compete - how will I convince my
collegues to use it :-)

(See attached file: x.cc)

cheers,
Steve.

********************
Copyright 2002 ADC Telecommunications, Inc. This communication is
the property of ADC and may contain information confidential and/or
privileged.  This communication has been transmitted for the exclusive
use of the intended recipient.  If you are not the intended recipient,
please send a copy of it with the title "Received in error" to
ssd_support_centre@adc.com and then delete the email and destroy
any copies of it.  You may not otherwise distribute, copy, or use this
communication or the information in it in any manner.  Please contact
ADC at 780 431-6565 if you need assistance. Thank you for your cooperation.

Attachment: x.cc
Description: Binary data


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