TString and ResizeIncrement


Recently a nice modification was done in TString to be optimized for short strings.
However, it looks to me that a feature to set resize increment was removed.

I am using TString to generate C++ source code, and the code can be as large as several MB. The size is not known a priori; I generate the code by adding lines one-by-one.
With ROOT 5.28 or older, I set the increment to be 32k, and it works fine.
On the other hand, I couldn’t find a corresponding function in the new TString; as a consequence, my generation program became 15 times slower.

Is there a method to set the increment for the new TString .

If not, are there some plans to modify TString for the next release to improve performance for long strings ?
(For example, always increase capacity at least twice of current size.)

Best regards,



I see the issue and will change the algorithm. The current ResizeIncrement() is a static which is not what you want in a threaded environment. I’ll let you know when I’ve made the change.

Cheers, Fons.

Hi Ryu,

I’ve improved the TString resize algorithm in the trunk. Please try and let me know how it works now.

Cheers, Fons.


The new TString is very fast for long strings too.

Thank you.