• 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: Is C's parameter passing more-efficient than ObjC's message passing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is C's parameter passing more-efficient than ObjC's message passing?


  • Subject: Re: Is C's parameter passing more-efficient than ObjC's message passing?
  • From: Charlton Wilbur <email@hidden>
  • Date: Sat, 11 Feb 2006 01:24:07 -0500


On Feb 10, 2006, at 8:36 PM, Erik Buck wrote:

Don't worry about it! If you are not aware of the different implementations between C function calls and Objective-C message passing then any attempt to select one over the other for performance reasons is almost surely premature optimization and misguided.

In particular, the overhead of dispatching a function or message send is usually miniscule compared to the time spent in the actual function. The Objective-C message dispatching buys you one heck of a lot of power and flexibility; by the time you get to 1000 or so lines of code, the computer time you save by micro-optimizing on that level is likely to be dwarfed by the programmer time you spend managing all that complexity by hand. Further, the relative amounts of time spent in message dispatching versus message implementation means that you're likely to see significantly more improvement by improving your algorithm and its implementation, delaying concerns of function or message dispatching until all other optimization has been done.


In other words: yes, C's parameter passing is more efficient in computer time than Objective-C's message dispatching. But Objective- C's message dispatching is *far* more efficient in programmer time, and frequently more resilient as well, once you get past a minimal size of program.

Charlton




-- Charlton Wilbur email@hidden email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Is C's parameter passing more-efficient than ObjC's message passing? (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: Instantiating an object by class from an NSString?
  • Next by Date: frontmost document window (of all running apps)?
  • Previous by thread: Re: Is C's parameter passing more-efficient than ObjC's message passing?
  • Next by thread: Instantiating an object by class from an NSString?
  • Index(es):
    • Date
    • Thread