[Bug libstdc++/29037] performance problem with std::string operator=(const std::string& str);
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Sep 12 21:01:00 GMT 2006
------- Comment #10 from pcarlini at suse dot de 2006-09-12 21:01 -------
(In reply to comment #9)
> > I see this point too, I have been thinking about something along those
> > lines, but you understand that we have an ABI, which we *must* keep
> > absolutely stable,
>
> Yes, I understand.
> But... don't you have a "private d-pointer" or pimple or however it is called ?
> Ok, this would mean that in every case at least one malloc/new would be
> required when creating a string object, which you maybe wanted to avoid...
Yes, that and more. And, remember, we cannot change class layouts, add data
members, nothing...
> No, no objections.
Ok. In the meanwhile you have various options, your workaround indeed, mine,
slightly more clean but slightly less efficient, you can restructure a bit the
loops to avoid string assigns after reserve. Ah, another possibility would be
simply avoid completely the assigns and use clear() and +=, that should work
exactly as fast as your best hack so far ;)
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29037
More information about the Gcc-bugs
mailing list