[comp.unix.questions] relative value of stripping symbols

guy@auspex.auspex.com (Guy Harris) (04/22/89)

This is a UNIX question, not a C question....

>Just a little question of some interest.  Suppose I have a C program that
>when compiled with the -g option (debugging symbols left in) (this is ATT
>Unix Sys V).  Does leaving these symbols in the file affect program 
>performance?

No.

>If the program is well written and all other things being equal, will
>the program take longer to load and will it run slower with the symbols in?  

Even if the program is horribly written, the code that implements "exec"
was written well enough that it doesn't bother reading the symbol table
- it doesn't have to.  Unless somebody's botched "exec", it should take
no longer to load with the symbols in (modulo any small odd effects such
as the last block of the file being larger due to symbols appearing
there).

The code itself has no idea whether the symbols are present, so it
should run no differently with the symbols removed, no matter how well
written it is (unless, of course, it knows its own pathname and opens
itself to read the symbols, in which case it may not run at all with the
symbols stripped; in any case, it shouldn't run slower with the symbols
present). 

wcs) (05/02/89)

In article <1484@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes:
] This is a UNIX question, not a C question....
] > Just a little question of some interest.  Suppose I have a C program that
] > when compiled with the -g option (debugging symbols left in) (this is ATT
] > Unix Sys V).  Does leaving these symbols in the file affect program 
] > performance?
] No.

Well, yes, actually.  The symbols themselves don't cause the problem, but
most  compilers turn  off optimization if you compile with  the -g option.
So you do end up with  slower code.
			Bill
-- 
# Bill Stewart, AT&T Bell Labs 2G218 Holmdel NJ 201-949-0705 ho95c.att.com!wcs
# also found at 201-271-4712 tarpon.att.com!wcs 

# welcome, to mars, eh, hosers!  Have a brew and some donuts, eh?