On Jan 29, 2014, at 6:41 PM, Uli Kusterer <witness.of.teacht...@gmx.net> wrote:

> On 30 Jan 2014, at 00:16, Rui Pacheco <rui.pach...@gmail.com> 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.

Unfortunately, sometimes you have to use C++, because there are many cool and 
useful libraries for it, as I’m sure most of you know. Many people (but not 
all) use C++ not because they want to or think it’s “fast”, but because they 
have to to leverage an existing library or codebase.

> 
> Cheers,
> -- Uli Kusterer
> “The Witnesses of TeachText are everywhere...”
> http://zathras.de
> 
> 
> _______________________________________________
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/sevenbitstech%40gmail.com
> 
> This email sent to sevenbitst...@gmail.com

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to