[DGD] COW arrays

Raymond Jennings shentino at gmail.com
Sun Jun 30 21:01:29 CEST 2013


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.

However, this causes array copy overhead, which is wasted in cases where
the callee (hopefully) is trustworthy most of the time.

Intended benefits:

Arrays that are copied but not modified simply get refcounted up and passed
by handle, and cow'ed if actually modified.

It might even save memory.



More information about the DGD mailing list