[swift-users] [Bug or ByDesign?] unowned optional values not allowed

Karl razielim at gmail.com
Wed Jul 6 06:59:01 CDT 2016


> On 5 Jul 2016, at 18:21, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> Longstanding bug, rdar://problem/17277899 <rdar://problem/17277899>. Surprisingly few people have asked for it.
> 
> Jordan
> 

Good to know, thanks.

Maybe not enough people know/care about the overheads of weak references?

Since the WWDC Swift performance talk I’ve been more conscious of eliminating unnecessary retains/releases. That goes for weak references as well, as (certainly on Obj-C), accessing the value means acquiring a lock to ensure nobody is trying to zero that reference while you read it: http://opensource.apple.com//source/objc4/objc4-493.9/runtime/objc-arr.mm <http://opensource.apple.com//source/objc4/objc4-493.9/runtime/objc-arr.mm> (see: objc_loadWeak). It’s basically never going to be in contention, but it’s still more overhead than a simple pointer.

Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160706/ae547ad9/attachment.html>


More information about the swift-users mailing list