• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is Swift really swift?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is Swift really swift?


  • Subject: Re: Is Swift really swift?
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 08 Jul 2014 22:03:39 -0700


On Jul 8, 2014, at 7:09 PM, Gerriet M. Denkmann <email@hidden> wrote:

Lesson learned: Swift inter-operates with Obj-C at quite a hight cost.

I think what you’re seeing is that, in a class that subclasses NSObject, methods are called using Obj-C dispatching (via objc_msgsend), which is a lot more expensive than the native Swift dispatching (closer to C++, i.e. using some mixture of vtables, direct function calls and inlining.)

Also, I was told by an Apple engineer at WWDC that native Swift objects have significantly faster retain/release implementations than Obj-C due to the lack of backward compatibility requirements. (IIRC, the main factor is that Swift objects can store the retainCount as a regular ivar, while Obj-C objects don’t have room and have to store it in an external global hash-table.)

—Jens
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Is Swift really swift?
      • From: Quincey Morris <email@hidden>
References: 
 >Is Swift really swift? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Is Swift really swift? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Is Swift really swift? (From: Jens Alfke <email@hidden>)
 >Re: Is Swift really swift? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Is Swift really swift? (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: How to delete a autolayout constraint in Xcode 6?
  • Next by Date: Re: Is Swift really swift?
  • Previous by thread: Re: Is Swift really swift?
  • Next by thread: Re: Is Swift really swift?
  • Index(es):
    • Date
    • Thread