Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc05!hpyhde4!hpycla!hpcuhc!hpcupt3!mnm From: mnm@hpcupt3.cup.hp.com (Michey Mehta) Newsgroups: comp.lang.c++ Subject: Re: c++ vs ada results Message-ID: <45680010@hpcupt3.cup.hp.com> Date: 14 Jun 91 01:16:11 GMT References: <1991Jun12.164741.412@news.larc.nasa.gov> Organization: Hewlett Packard, Cupertino Lines: 21 > 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. The real cost of a virtual function call in C++ is not the cost of the dispatch, but rather the cost of not being able to inline small time-critical virtual functions. A paper by Tektronix at the 1991 Usenix C++ conference described a "flattening" tool which provided speedups of three times by making all virtual functions in leaf classes into non virtual functions. There is some literature about link time inlining, but such linkers are not yet widely available. Michey Mehta Hewlett-Packard California Language Lab