• 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: ObjC in time-critical parts of the code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC in time-critical parts of the code


  • Subject: Re: ObjC in time-critical parts of the code
  • From: Scott Ribe <email@hidden>
  • Date: Sun, 18 Jan 2009 08:26:41 -0700
  • Thread-topic: ObjC in time-critical parts of the code

Good grief, no. I'm not just talking about accessors. Try re-reading:

> In addition, in many cases where Objective-C would have one or more method
> dispatches in innermost performance-critical regions, with C++/STL you will
> have NO FUNCTION CALL AT ALL, but rather direct pointer-based data access or
> inlined code. In my own testing, I've found that to be the biggest difference,
> because Objective-C method dispatch is in fact pretty efficient method
> dispatch.

Objective-C severely limits the degree of inlining that can be accomplished
when using classes and method calls. C++ allows (promotes, really) a heavy
degree of inlining.

> I'm not sure you appreciate the irony of having "people who don't
> really understand Objective-C" and "but in Objective-C would require
> raw C" in the same sentence.

There is no irony at all. Of course Objective-C is just C plus an efficient
dispatcher & some easy syntax. Of course you can rewrite in raw C. The point
was, in C++, you can get the same performance as the raw C, but without
using raw C, while still using the higher-level objects & method calls
(which in some cases will even be far less verbose than Objective-C.)

> As a consequence of this, your statements that "ObjC is far less
> efficient than C" are rather specious.

I never said any such thing. Please do not set up straw man arguments to
knock me down--I *will* call you on it, *every* single time.

> The only reasonable way I can
> think of that would lead you to this conclusion is that you're not
> comparing apples to apples, i.e. you're using struct->var type
> accesses in C, and getter/setter runtime dispatched methods in ObjC.

You clearly have no idea about the optimization possibilities of C++ class
templates.

In essence, the stricter/static typing of C++ allows many more optimizations
to be applied to object-oriented code (not just plain C), and the more
dynamic typing of Objective-C restricts the possibilities (while enabling
techniques that are particularly nice for UI work).

--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

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: 
 >Re: ObjC in time-critical parts of the code (From: John Engelhart <email@hidden>)

  • Prev by Date: Re: this class is not key value coding-compliant ...
  • Next by Date: Re: Yo
  • Previous by thread: Re: ObjC in time-critical parts of the code
  • Next by thread: Re: ObjC in time-critical parts of the code
  • Index(es):
    • Date
    • Thread