On Thu, Nov 04, 2004 at 09:10:03PM +0100, Mirar @ Pike developers forum wrote:
Is there *a lot* of benifit in not sharing buffer strings?
There is - in data pumping applications, or when you want to filter data and store it in intermediate buffer. Current Buffer() is much more faster that string addition operations, but it is sometimes useful to access buffered data in middle, i.e. without the need to Buffer()->get() first (which will create shared string).
One of my apps, for instance, reads data from remote source and periodically checks if (so far accumulated) stream is valid packet (packets may be as big as few megabytes). I cannot use Buffer() for this, since I can't search in buffers, and every buffer += makes things slower and slower with new chunk...
Mutable strings would be nice too, BTW - again, performance gain is significant.
Regards, /Al