[Sussex] C++ Compile and Run-Time Performance

Steve Dobson SDobson at manh.com
Mon Oct 28 17:45:00 UTC 2002


Sluggers/INSIDERs

If your interested in C++ programming and program performance
then take a look at:
http://forte.sun.com/s1scc/articles/CC_perf/index.html

I cross posted it to the INSIDEr's list as I wanted it on
record there for any future INSIDErs.

This is a must read of all INSIDEr developers.  But we ware
it is written from the point of view of commercial development.
Note the line in the introduction: "Therefore, you should
consider run-time and compile-time performance improvements
only when justified by improvements in overall product quality
and timeliness."  As we have already agreed INSIDE will be 
developed for quality, timeliness and other marketing issues
will _not_ be part of our thinking.

Compilation Notes:
------------------

To achieve the fastest build times, compile without -g and
without optimization. 
	I'm guilt of not doing this!!!!!  The make rules I 
	wrote for INSIDE have -g on.  As I don't use the debugger
	that often I change the build rules not to use -g and
	add a new target "debug" which will turn it on.

Use file systems that are local
	As we're using CVS this shouldn't be a problem.

Abstraction Notes:
------------------

...unbridled abstraction...
	I'm guilty of this from time to time (see slog.h).  New 
	rule for INSIDE (unless Geoff disagrees).  When writing
	a Wrapper Facade class the C include will NOT be included
	in the header file.

Multiple Classes Notes:
	Again I'm guilty.  Recently I split by socket streams into
	separate files.  I'll will correct this error.

Incomplete Classes Notes:
	I've used both, but tend to "#include" if I can and only use
	"class ..." to avoid circular includes.  I had never considered
	the effect of compiler time.  From now on I will.

Guarded Includes Notes:
-----------------------

I've always avoided
	#ifndef SERVICE_H
	#include "service.h"
	#endif
as being messy in the header - but now I'll reconsider that.  This
does not, of course, mean that you can miss out the
	#ifndef SERVICE_H
	#define SERVICE_H
		.
		.
		.
	#endif \\ SERVICE_H
from the header file (note the comment so you can tell which #if this
matches).

Temporary Objects Notes:
------------------------

Hadn't thought of that - must remember

Steve




More information about the Sussex mailing list