Re:Performance Improvement with the StringBuilder for C++
by vinkelhake on Friday September 06, 2013 @11:07AM
(#6340796)
This is just a side note, but a problem with accumulate in this context is that is defined as doing `acc = op(acc, element)` for each element. This means that whatever allocation the accumulator had is going to be thrown away on each iteration of the loop. Had it been defined as `acc += element`, then allocation schemes such as doubling the allocated memory would have been more effective and greatly reduces the number of allocations (and copies).
[ Parent
| on HN ]
There are no comments on this comment yet.