Re:Performance Improvement with the StringBuilder for C++
by lucian1900 on Friday September 06, 2013 @11:26AM
(#6340883)
Trees (like the ropes you might use in this case) are not necessarily faster on modern CPUs. Caches and branch prediction tend to dominate performance in such cases.
[ Parent
| on HN ]
Re:Performance Improvement with the StringBuilder for C++
by gngeal on Friday September 06, 2013 @02:49PM
(#6341997)
I don't see how branch prediction and caches could dominate performance of logically concatenating a huge amount of text instead of doing it physically.
Re:Performance Improvement with the StringBuilder for C++
by dkersten on Friday September 06, 2013 @03:16PM
(#6342119)
I guess it depends on what other operations you need. If the only operation you need is concatenation then trees are definitely faster. Otherwise it depends.
Re:Performance Improvement with the StringBuilder for C++
by lucian1900 on Saturday September 07, 2013 @01:45PM
(#6345789)
Arrays and copies are often faster than the equivalent structure-sharing trees, under a certain size at least.