[swift-dev] [idle] COW wrapper in 30 lines
Nadav Rotem
nrotem at apple.com
Wed Mar 9 11:50:36 CST 2016
HI Jordan,
Very Nice!
There is a similar implementation and discussion about performance here:
https://github.com/apple/swift/blob/master/docs/OptimizationTips.rst#advice-use-copy-on-write-semantics-for-large-values
-Nadav
> On Mar 9, 2016, at 9:39 AM, Jordan Rose via swift-dev <swift-dev at swift.org> wrote:
>
> Just for fun, I wrote a wrapper for COW types that don't 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!
>
> Disclaimer: This is not performant; don't use it in your app.
>
> Jordan
>
> <cow.swift>
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160309/da92261c/attachment.html>
More information about the swift-dev
mailing list