[comp.lang.c++] 1.2 vs 2.0 program size

psrc@pegasus.ATT.COM (Paul S. R. Chisholm) (11/11/89)

In article <1473@aber-cs.UUCP> pcg@cs.aber.ac.uk (Piercarlo Grandi) writes:
> Actually, a requirement for C (and C++ by extension) is that the
> implementation must provide FAST procedure calls...

In article <1989Nov8.181203.1967@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes:
> From my notes from a Usenix conference a few years ago:
>    Steve Johnson, talking about the cost of function calls in C:
>...
>    The result was fairly cleanly-built programs, some of which unfortunately
>    spend 50% of their time in the call/return sequence when run on a VAX.

(This from the person who tells people not to believe all the world's a
VAX?-)

Part of the VAX architectural design was the standard way to make
subroutine calls.  The architects at DEC came up with a method that was
simple, straightforward, language independent, friendly to debuggers and
other such tools . . . and very inefficient of time.

Steve Johnson, who did the first (and maybe most important) VAX C
compiler, was faced with a dilemma.  Accept the VAX design, with its
merits and its performance penalties?  Or be an orphan, closing the
door on any chance of communicating with other code?  He was doing a
research project, not a commercial product; as such, the first choice
was a clear winner over the second.

I'd say the high subroutine call overhead, not just in general but in
the VAX in particular, was one of the sparks* that lead to the Reduced
Instruction Set Computer (RISC) movement.

All of which goes to show that inlining functions can be a big win,
especially with abstract data types (object-oriented or not), where you
write lots of trivial subroutines to provide limited access to a value.

> Henry Spencer, uunet!attcan!utzoo!henry, henry@zoo.toronto.edu

Paul S. R. Chisholm, AT&T Bell Laboratories
att!pegasus!psrc, psrc@pegasus.att.com, AT&T Mail !psrchisholm
I'm not speaking for the company, I'm just speaking my mind.
VAX is a trademark of Digital Equipment Corporation (I think).

*No pun intended (yeah, right:-)