[DGD] COW arrays

Felix A. Croes felix at dworkin.nl
Sun Jun 30 23:33:35 CEST 2013


Raymond Jennings <shentino at gmail.com> wrote:

> Speaking strictly from a perspective of merit (I plan to work out
> implementation later if it's worth the trouble), would making duplicated
> arrays copy on write be worthwhile?
>
> Use case:
>
> For security reasons, it's often wise to pass arrays by value, ala
> array[..], to keep the callee from tampering with the contents of the
> master version.

It would mean a minor slowdown and would probably not save memory,
since arrays copied in the manner you describe are usually exported
to other objects, where they'll be copied anyway.  The minor slowdown
would come from the COW administration overhead, which of course would
also have an impact on memory usage.

A more interesting approach would be to make arrays copy-on-write in
all cases.  But that, of course, would be a change to LPC.

Regards,
Felix Croes



More information about the DGD mailing list