develooper Front page | perl.perl6.internals | Postings from June 2001

RE: The internal string API

Thread Previous | Thread Next
Dan Sugalski
June 20, 2001 10:54
RE: The internal string API
Message ID:
At 10:31 AM 6/20/2001 -0700, Hong Zhang wrote:

> > The one problem with copy-on-write is that, if we implement it in
> > we end up paying the price to check it on every string write. (No free
> > depending on the hardware, alas)
> >
> > Not that this should shoot down the idea of COW strings, but it is a cost
> > that needs considering. (I suppose we could have a COW subtype of the
> > scalar and string scalar)
>Even with software implementation, it can come almost free.

I'm usually nervous about 'almost free' things, but in this case...

>Since this enables us intern
>all literal strings without introducing another data type, I would say the
>overhead is minimal.

Between Dave pointing out the obvious (COW being done via vtable functions, 
so only the COW scalars pay) and the potential to save space with copies of 
constant strings, I think it'd be silly to not implement a COW scheme for 
perl 6.


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                      teddy bears get drunk

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About