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]

A couple of numbers (Re: [patch/rfa] Tiny but delicate...)


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.



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