News for hackers. Stuff that matters.
Re:Performance Improvement with the StringBuilder for C++ by ndepoel on Friday September 06, 2013 @10:04AM (#6340455)
How does this compare to std::stringstream? I don't see any mention of that class in this article.
Re:Performance Improvement with the StringBuilder for C++ by CJefferson on Friday September 06, 2013 @10:12AM (#6340496)
I was just about to post this.

If I use ostringstream, and also I change the code so it has to construct the StringBuilder every test (at the moment they build it once and then keep calling 'toString'), then I get the output (from the test program on that website):

    Accurate performance test:
      ostringstream took 0.0120331 seconds, and ToString() took 0.0221947 seconds.
      The relative speed improvement was -45.784%
      Join took 0.0176613 seconds.
Re:Performance Improvement with the StringBuilder for C++ by jonhohle on Friday September 06, 2013 @10:47AM (#6340696)
I came to post the same thing, and got similar results:

     Accumulate   took 0.00195327 seconds
     ToString()   took 0.00283577 seconds.
     Join         took 0.00462704 seconds.
     stringstream took 0.00084927 seconds.
    The relative speed improvement was -71.1482%
Re:Performance Improvement with the StringBuilder for C++ by zenbowman on Friday September 06, 2013 @10:35AM (#6340626)
Exactly, seems like he's just reimplemented std::stringstream in a worse manner.