Do protocols come with any overhead? (ie. obvious benefits aside, do they slow things down?)
Do protocols come with any overhead? (ie. obvious benefits aside, do they slow things
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From a runtime point of view (and as far as I know), protocols have no impact on performance because the cost of sending a message is the same, whether the instance is referenced by its class or by a conforming protocol.
From a programming point of view, protocols offers a lot of flexibility, especially when you are designing low-coupling API. The Protocol chapter in the Objective-C Programming Guide is pretty comprehensive on the features provided. You might take a look at it.