• 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: Message Forwarding Overhead / Performance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Message Forwarding Overhead / Performance


  • Subject: Re: Message Forwarding Overhead / Performance
  • From: "Michael Ash" <email@hidden>
  • Date: Tue, 28 Oct 2008 13:34:28 -0400

On Tue, Oct 28, 2008 at 11:30 AM, Jerry Krinock <email@hidden> wrote:
> Although the documentation on message forwarding [1] explains that alot of
> stuff needs to happen, it does not say "Warning: Don't do this in
> performance-critical applications".

Such a warning would be foolish, since that isn't true in the general
case. There are plenty of operations which take *vastly* longer than
message forwarding which don't come with that warning either.

>  So I made a test tool which forwarded a
> simple message with one integer argument to a class which would add it to
> its 'sum', an instance variable.
>
> Sending this message 10,000 times and comparing the difference in elapsed
> time with a similar task that sends a similar message directly, I found that
> the average overhead for forwarding one message on my Intel Core 2 Duo Mac
> Mini was about 20 microseconds.
>
> That would be unacceptably slow for an iterated operation in a my
> application, and I decided to not use message forwarding in this particular
> case.
>
> Has anyone ever seen better performance for message forwarding?

If 20us is too long for you (is it really? do you need to do this more
than 50,000 times per second?) and you can require 10.5 and you just
need strict forwarding of the identical message to another object (as
opposed to intercepting the message and doing more clever processing),
then the -forwardingTargetForSelector: method is likely to give you
considerably better performance.

Mike
_______________________________________________

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

References: 
 >Message Forwarding Overhead / Performance (From: Jerry Krinock <email@hidden>)

  • Prev by Date: . Re: Code signing validation
  • Next by Date: Re: Turning off Auto Complete feature for NSTextField
  • Previous by thread: Re: Message Forwarding Overhead / Performance
  • Next by thread: Re: Message Forwarding Overhead / Performance
  • Index(es):
    • Date
    • Thread