Re: Performing the selector from a stored IMP
Re: Performing the selector from a stored IMP
- Subject: Re: Performing the selector from a stored IMP
- From: Tito Ciuro <email@hidden>
- Date: Fri, 11 Feb 2011 12:40:08 -0800
Hello,
Being curious about the performance implications of using NSInvocation vs Objective-C message send vs IMP-cached message send, I was surprised to see how much slower NSInvocation seems to be compared to the other two mechanisms (the following data was last collected on Leopard, so these results could have changed in SnowLeopard):
Name Iterations Total time (sec) Time per (ns)
IMP-cached message send 1000000000 0.7 0.7
Objective-C message send 1000000000 4.9 4.9
NSInvocation message send 10000000 0.8 77.3
The above metrics can be found here: http://www.mikeash.com/pyblog/performance-comparisons-of-common-operations-leopard-edition.html
Cheers,
-- Tito
On Feb 11, 2011, at 12:20 PM, Joanna Carter wrote:
> Hi Matt
>
>> Consider NSInvocation... m.
>
> Hmmm, nice!
>
> My only objection to using it in the circumstances I have is that it is a lot more code to setup than the idea of a protocol with three methods, implemented by the target class.
>
> However, I am indebted to you for pointing out this class and shall remember it for future use. IMO, this is truly the next best thing to a delegate (as it is known in C#).
>
> Joanna
>
> --
> Joanna Carter
> Carter Consulting
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden