C++ and C

Kipp Hickman kipp at warp.esd.sgi.com
Tue Feb 27 05:04:58 AEST 1990


We did some performance tests with C++, running the most recent version of
the dhyrstone tests through the C++ compiler.  The results were identical
to the standard C numbers.  We even tweaked the tests to use C++ language
features and were able to improve the numbers.

The trick with C++ is to use it "effectively".  There are pieces of your
code that aren't performance critical - you can use C++ fully here, without
worry.  Other sections of your code will be highly critical - use C++, but
use it carefully, so that it is generating the same old fast C code.  A good
thing to avoid if you have a performance critical section is subroutines.
(this is true for C too) The mips compilers will optimize the #@$(&#@&$
out of the code, as long as a subroutine isn't called (that way it knows
it can safely put memory cells into registers, etc.).

Hope this helps.

					kipp hickman
					silicon graphics inc.



More information about the Comp.sys.sgi mailing list