[swift-dev] [idle] COW wrapper in 30 lines

Joe Groff jgroff at apple.com
Thu Mar 10 17:58:10 CST 2016


> On Mar 10, 2016, at 3:54 PM, Dave Abrahams via swift-dev <swift-dev at swift.org> wrote:
> 
> 
> 2. The thing in your box has to be a value type for this to work.  It's
>   pretty uncommon that a thing that's already a value type benefits
>   from being CoW-ified in this way.  

It doesn't need to be particularly largeā€”if your value type contains two or more refcounted fields, it becomes cheaper to retain/release a single indirect box than to copy around the entire value inline.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160310/940f720a/attachment.html>


More information about the swift-dev mailing list