(ref.doc)ellis 061293

Next oreilly 061293 Prev: ark 021293 Up: Usenet

From: [email protected] (-TEMP-+Ellis M.) (Note:
 ellis)
Newsgroups: comp.lang.c++
Subject: Re: C++ Performance
Date: 6 Dec 1993 15:06:10 -0500
Organization: UNIX System Laboratories
NNTP-Posting-Host: marble.usl.com

In article <[email protected]> [email protected] writes:
:In article <[email protected]>, [email protected] (Bill Crocker) writes:
:> In article [email protected], Darryl Rouse <[email protected]> () writes:
:> >
:...
:> HOWEVER ... many of your inline functions are quietly implemented
:> out-of-line by the compiler (use the -w option with cfront.)
:
:There's one particularly horrendous case around constructors.
:
:A member object can never need to be dynamically allocated, yet it's
:constructor will check its `this' pointer.  For out-of-line constructors,
:that's OK, but when the constructor is moved inline, cfront should know
:to omit the ``if _this_ == 0 || ! ( _this_ = __nw( sizeof this ) ) ...''
:code.
:
:Because it doesn't, a constructor whose members each have constructors
:initializing a few built-in types, a constructor that could be completely
:inlined with less overhead than the function call to the first constructor,
:becomes too complicated to inline.  Out-of-line copies must be generated.
:
:This constructor happens to be for a template that is used in many places
:(a pointer that knows to deallocate what it holds when it is destroyed).
:Now an out-of-line copy of the constructor must be created for each
:specialization of the template.  This is the only function that forces these
:copies to be made and compiled, so 20 or 30 more template instance files
:must be created and compiled each time.
:
:And of course, there is the lost space in the exectution image.
:-- 


USL has already implemented an option that omits the this==0 checks
in constructors.  It is implemented in 3.0.1 and 3.0.2, but has not
been advertised because it breaks link compatibility (and we were
committed to maintaining through those releases).  Anyone who has
source can edit main.c and set perf_opt to 1, then rebuild cfront,
and recompile the world.

Release 3.0.3 (coming soon) will be the same as 3.0.1 and 3.0.2 with
respect to perf_opt.

You don't have source?  Maybe your provider will build you a binary
with perf_opt turned on.  Or make it settable from the command line.

M. A. Ellis

-- 

Disclaimer: My employer paid me to say this.


automatically generated by info2www version 1.2.2.8