• 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: NSInvocation question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSInvocation question


  • Subject: Re: NSInvocation question
  • From: Chris Suter <email@hidden>
  • Date: Fri, 22 Feb 2008 15:18:57 +1100


On 22/02/2008, at 3:00 PM, Hank Heijink wrote:

I made NSInvocations because timing is critical and I didn't want to spend the time constructing the call when it needs to be invoked. I haven't profiled the difference yet though, so maybe the tradeof isn't bad. I'll give it a whirl.

I'm not sure what exactly you're trying to do, but NSInvocation isn't that fast a way of making a call. It's certainly going to somewhat slower than a compiler generated call and it's not NSInvocation's intended use.


If you want fast calls, you should use -[NSObject methodSelector:], cache the result and then call it directly with whatever arguments you want. Make sure you read the documentation to see an example as it usually requires a cast.

Having said that, let me say what has been said many times before, unless you know it's going to be a performance bottleneck, you should be writing your code so that it's as readable/maintainable as possible and then optimise for performance if necessary.

- Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: NSInvocation question
      • From: Hank Heijink <email@hidden>
References: 
 >NSInvocation question (From: Hank Heijink <email@hidden>)
 >Re: NSInvocation question (From: Nir Soffer <email@hidden>)
 >Re: NSInvocation question (From: Hank Heijink <email@hidden>)

  • Prev by Date: Re: [self setLayer:] in initWithFrame:
  • Next by Date: Re: Optional methods
  • Previous by thread: Re: NSInvocation question
  • Next by thread: Re: NSInvocation question
  • Index(es):
    • Date
    • Thread