• 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: Xcode 5 & Obj-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode 5 & Obj-C++


  • Subject: Re: Xcode 5 & Obj-C++
  • From: Uli Kusterer <email@hidden>
  • Date: Thu, 30 Jan 2014 00:41:47 +0100

On 30 Jan 2014, at 00:16, Rui Pacheco <email@hidden> wrote:
> To those of you doing Objective-C++ apps, is there a difference in terms of performance or memory usage?
>
> I’ve noticed that TextMate 2, which is done in Objective-C++, consumes less memory than the Chocolat editor which seems to be done exclusively in Cocoa.

 Give the nature of C++, it’s not surprising that performance can often be better. They generally tend to put a higher emphasis on performance than on programmer comfort, maintainability etc. Also, C++ can do a lot of mean tricks due to the more static nature of the language. E.g. their method dispatch is not easy to keep binary stable across releases, so is really badly suited for API design in dylibs or frameworks, but probably only needs two pointer dereferences and one addition to resolve a method, while ObjC actually has to perform the look-up at runtime, but therefore works much better as a library API.

 I don’t usually have to drop down to C++ unless:

1) I’m in very performance-critical code, like device drivers, video decoders etc.
2) I need my code to be cross-platform, because C++ is really the most reliably available OO-language everywhere from Android to Windows to iOS.

 Unless you’re in one of those situations, I wouldn’t drop down to C++ just because it “is probably faster”. It helps nobody if your app crashes faster because all that code you rewrote that you’d get for free in ObjC or C# or the ADK is buggy. The more people use a piece of code, the more likely it is one of them found a bug got it fixed. Tested code is always better than new, “fast” code.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_______________________________________________

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: Xcode 5 & Obj-C++
      • From: Eric Wing <email@hidden>
References: 
 >Xcode 5 & Obj-C++ (From: Peter Teeson <email@hidden>)
 >Re: Xcode 5 & Obj-C++ (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Preserving undo actions on deleted targets
  • Next by Date: Re: Delays in awaking iOS app
  • Previous by thread: Re: Xcode 5 & Obj-C++
  • Next by thread: Re: Xcode 5 & Obj-C++
  • Index(es):
    • Date
    • Thread