discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C cross platform compilation


From: Richard Frith-Macdonald
Subject: Re: Obj-C cross platform compilation
Date: Fri, 11 Apr 2003 09:13:40 +0100


On Friday, April 11, 2003, at 05:46  am, Willem Rein Oudshoorn wrote:

- would the binary run slower than straight C++?

Well [object method] is slower than a C-function: function (object)
But not dramatically so.

Also, while this is technically true, it's misleading in my experience ...
Large ObjC applications tend to run faster than similar sized C++
applications developed on similar timeframes... presumably because
they tend to have simpler code and more attention can therefore be
paid to designing the application to run efficiently.

Equally though, a poorly designed ObjC program, which completely
ignores the fact that there are messaging overheads, can run slowly
(but you can develop it more quickly).

IMO awareness of the fact that there *is* a messaging overhead is
actually an incentive to produce better Object-Oriented designs,
since it encourages you to write a smaller number of more powerful
methods so that you keep the number of messages you use down
(minimising overheads) ... this is strongly related to simpler and
more maintainable code as well as to better performance.

Texts about C++ tend to emphasize the 'zero' message overhead
aspect of non-virtual calls, which leads to a programming style in
which a lot of trivial, low-level methods are implemented ... which
leads to larger, more complex, less maintainable, and slower code
over all.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]