On Feb 21, 2008, at 11:18 PM, Chris Suter wrote:
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.
I should have realized that when NSInvocation started giving me
trouble...
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.
The nice thing about NSInvocation is not so much its efficiency (or
lack thereof, as the case may be), but the fact that once you've got
the thing constructed, you can just call invoke on it, without having
to think about what's inside. I have functions of zero, one, or two
arguments that I wrapped up in NSInvocations. With IMPs, I have to
check the number of arguments both for the typing and for the call.
However, even with the check for number of arguments, an IMP is very
very fast.
Thanks!
Hank
Hank Heijink
[EMAIL PROTECTED]
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]