Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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.


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-...


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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: