<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">HI Jordan, </div><div class=""><br class=""></div><div class="">Very Nice! </div><div class=""><br class=""></div><div class="">There is a similar implementation and discussion about performance here:</div><div class=""><br class=""></div><a href="https://github.com/apple/swift/blob/master/docs/OptimizationTips.rst#advice-use-copy-on-write-semantics-for-large-values" class="">https://github.com/apple/swift/blob/master/docs/OptimizationTips.rst#advice-use-copy-on-write-semantics-for-large-values</a><div class=""><br class=""></div><div class="">-Nadav</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 9, 2016, at 9:39 AM, Jordan Rose via swift-dev <swift-dev@swift.org> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Just for fun, I wrote a wrapper for COW types that <i class="">don't</i> need the flexible inline storage of ManagedBuffer. It turned out to be pretty straightforward, though I didn't bother with materializeForSet and thus am incurring the cost of many extra value copies on mutation. The major downside is having to forward all operations through, something I'm sure the implementers of Array and Dictionary are very used to!<div class=""><br class=""></div><div class="">Disclaimer: <b class="">This is not performant; don't use it in your app.</b><br class=""><div class=""><br class=""></div><div class="">Jordan<br class=""><div class=""><br class=""></div><div class=""></div></div></div></div><span id="cid:7628D88D-C9C7-447E-92CC-25FA6052B6DC@apple.com"><cow.swift></span><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div class=""><div class=""><div class=""></div></div></div></div>_______________________________________________<br class="">swift-dev mailing list<br class="">swift-dev@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></div></body></html>