Re:I loved C. But it always fell short for me. Objective-C f...
by kstenerud on Monday November 07, 2011 @11:47AM
(#3206997)
In terms of size, they're almost the same (Objective-C classes are implemented with structs). In terms of speed, the difference is absolutely huge. You can generate a random number faster than you can make an Objective-C call.
But, it's fast enough for 95% of things people do with it.
Re:I loved C. But it always fell short for me. Objective-C f...
by madmoose on Monday November 07, 2011 @04:39PM
(#3208287)
Objective-C message sends are not much slower than C++ virtual calls:
http://mikeash.com/pyblog/performance-comparisons-of-common-...
And that's from 2008. Clang's improved it a lot.
Re:I loved C. But it always fell short for me. Objective-C f...
by Groxx on Tuesday November 08, 2011 @06:58PM
(#3213506)
Actually, that's on an iPhone. Here's the article for OSX from the start of 2008 (two months before your link), where the cached message call comes out faster than the virtual calls, and the non-cached is ~ 4.5x slower instead of ~ 2x on the iPhone:
http://mikeash.com/pyblog/performance-comparisons-of-common-...
Re:I loved C. But it always fell short for me. Objective-C f...
by infinite8s on Monday November 07, 2011 @03:06PM
(#3207888)
Exactly. Many of the benefits of Obj C's dynamism come into play with the UI, where the main speed constraint is the response time of the user. And whenever you need to write compute bound code it is easy to drop down into C.
This actually makes me wonder... how much overhead is in each objective c object over a similar struct in c?