2 ms·
> all the blazing speed of Smalltalk If you're alluding to cost of message send, then it's pretty low, and can easily be made faster in case it becomes noticea
by pornel 16y ago
> all the blazing speed of Smalltalk
If you're alluding to cost of message send, then it's pretty low, and can easily be made faster in case it becomes noticeable:
http://www.mikeash.com/pyblog/performance-comparisons-of-common-operations-leopard-edition.html http://www.mikeash.com/pyblog/performance-comparisons-of-com...
- ootachi 16y agoAccording to the link you posted, that's over four times slower than C++ virtual method dispatch (and note that most method calls in ordinary C++ code are not virtual). Also, IMP caching is hardly easy and is quite fiddly: see for example the benchmark code in that link as well as [1]. I highly recommend reading the tour of objc_msgSend [2]. It's very eye opening: for example, there's a cache scanning loop even in the fast case. [1]: http://www.mulle-kybernetik.com/artikel/Optimization/opti-3-imp-deluxe.html http://www.mulle-kybernetik.com/artikel/Optimization/opti-3-... [2]: http://www.friday.com/bbum/2009/12/18/objc_msgsend-part-1-the-road-map/ http://www.friday.com/bbum/2009/12/18/objc_msgsend-part-1-th...
- foljs 16y ago>According to the link you posted, that's over four times slower than C++ virtual method dispatch Hmm, check the results in the same page for the 64bit Cocoa runtime. This is where most optimizations are made, because Apple used the 32->64 bit transition as an opportunity to do most binary compatibility breaking changes to the language. There, in 64bit, the IMP cached msg send is actually FASTER than C++ virtual method dispatch. And if your app's performance suffers because of method calls / msg sends, you are doing it wrong. They should be an insignificant amount of time compared to the actual processing stuff done by your app.