On Fri, 5 Jul 2002, Nicholas Clark wrote:
: On Fri, Jul 05, 2002 at 02:54:18PM +0200, Aldo Calpini wrote:
: > this approach saves memory, because you can create as many copies of a
: > string as you want, without allocating it many times. unless you modify
: > them, at least. it's also usually a great speed boost, because copying a
: > string is performed in O(1) time, instead of O(n) - where n is the size of
: > the string.
: 
: I suspect that the speed boost is going to be more noticeable for most
: applications than the memory saving. It doesn't matter if I'm wrong on this :-)

It's a real win for regexes that want to map $1, $2, etc. onto an existing
string.  Not to mention $`, $& and $'.

Larry

Reply via email to