This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
A couple of numbers (Re: [patch/rfa] Tiny but delicate...)
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, Nathan Myers <ncm at cantrip dot org>
- Date: Sun, 17 Oct 2004 17:13:18 +0200
- Subject: A couple of numbers (Re: [patch/rfa] Tiny but delicate...)
- References: <4170164A.3070907@suse.de>
Paolo Carlini wrote:
..... If the idea works we
obtain, not only a slightly simpler _M_mutate, but, more importantly,
we keep on using the empty_rep trick even after things like
string str;
str.append(0, 'x');
which currently leads to normal dynamically allocated memory.
A tiny test to give you an order of magnitude of the improvement
(actually, this is for the further tweaked version of the patch):
for (unsigned i = 0; i < 10000000; ++i)
{
std::string a;
a.append(0, 'x');
}
current
-------
2.530u 0.000s 0:02.53 100.0% 0+0k 0+0io 168pf+0w
patched
-------
0.500u 0.000s 0:00.50 100.0% 0+0k 0+0io 157pf+0w
Paolo.