c++ vs ada results

Dan L. Pierson pierson at encore.com
Thu Jun 13 07:27:54 AEST 1991


Regarding c++ vs ada results; alan at hal.larc.nasa.gov (alan dare) adds:
(quoting someone else; don't blame him :-))
> o       Ada has better support for embedded systems'
>         work than C++.  C++'s OO mechanisms
>         (particurlarly dynamic binding) exact a performance
>         penalty that will not be acceptable for some
>         hard real-time systems.

This assertion contains a common misconception about dynamic binding
_for languages which support both dynamic and static binding_.  Such
languages include C++, Common Lisp/CLOS and the current proposal for
Ada 9X.

The misconception is that the performance of a dynamically dispatched
(bound) function call should be compared to that of a normal function
call.  It should not; it should be compared to the performance of a
normal function call PLUS a case statement.  If you don't need the
case statement you should have used a statically bound call*.

A good implementation of dynamic dispatch for any of these languages
can be faster than static call plus case.  There are several existence
proofs for C++ and Common Lisp/CLOS, but I don't have the citations
handy. 

*Of course, a poor programmer can overuse dynamic binding with greater
ease than explicit case statements.  IMHO, all of the cited languages
have enough such options already available that this isn't a big
issue when weighed against the advantages in software construction and
reuse provided by dynamic binding.
--

                                            dan

In real life: Dan Pierson, Encore Computer Corporation, Research
UUCP: {talcott,linus,necis,decvax}!encore!pierson
Internet: pierson at encore.com



More information about the Comp.sys.sgi mailing list