develooper Front page | perl.perl6.internals | Postings from July 2002

Re: Parrot Glossary - COW

Thread Previous | Thread Next
From:
Larry Wall
Date:
July 5, 2002 10:12
Subject:
Re: Parrot Glossary - COW
Message ID:
Pine.LNX.4.44.0207051009320.12144-100000@london.wall.org
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


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About