in reply to Re^2: Is there something faster than string concatenation?
in thread Is there something faster than string concatenation?
Over the course of doing this, every once in a while your realloc is going to need to move/copy. It seems like that should bite you over the long run.Probably. If that happens, the array push/join mechanism may be the fastest. I don't know how string filehandles work exactly, but I bet they do indeed just front for concatenation.
As you can see, though, usually string concat is the fastest solution. I wouldn't worry about it too much unless you're dealing with *really* huge strings, and by that time may want to move to on-disk files anyway, since you're probably taking up a fairly significant chunk of system memory.
|
---|