[Bug libstdc++/20706] string::reserve severe performance regression

pcarlini at suse dot de gcc-bugzilla@gcc.gnu.org
Thu Mar 31 21:14:00 GMT 2005


------- Additional Comments From pcarlini at suse dot de  2005-03-31 21:14 -------
I should also add, that, in general, your snippet could be simpler, without
penalizing the performance: typically reserve is only called once, at the 
outset, if we can estimate in advance the final size of the string. Otherwise,
internally, the implementation is *automatically* able to quickly grow the
capacity to satisfy efficiently a series of consecutive append: in our implement
the capacity automatically doubles every time is reached by the size of the 
growing string.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20706



More information about the Gcc-bugs mailing list