home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:20005 comp.lang.c++:19658
- Newsgroups: comp.lang.c,comp.lang.c++
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!kronos.arc.nasa.gov!butch!netcomsv!netcom.com!erc
- From: erc@netcom.com (Eric Smith)
- Subject: Re: C/C++ Correctness (was: Re: C/C++ Speed)
- Message-ID: <1993Jan21.081537.8192@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- References: <1993Jan18.171841.3008@informix.com> <1jka6h$n32@agate.berkeley.edu> <1jkismINN3qq@armory.centerline.com>
- Date: Thu, 21 Jan 1993 08:15:37 GMT
- Lines: 22
-
- In article <1jkismINN3qq@armory.centerline.com> jimf@centerline.com (Jim Frost) writes:
- ...
- >It's true that if you use C++ as a C with better type checking there
- >will be few runtime performance penalties. In fact, C++ inlining
- >alone can overcome many performance drawbacks.
-
- That implies that C++ has performance drawbacks to overcome, but there
- are none except when using specific non-C features of C++ which are easy
- to avoid, if avoiding them is desired.
-
- Inlining can in fact make C++ faster than C, especially if it's the
- only non-C feature you use in C++. For many C programmers, inlining
- alone is enough to justify the move to C++.
-
- The way to make inlining effective is to use it carefully, and only
- inline the most critical speed sensitive functions. If you inline
- functions that don't really need it, you pay a penalty in size of your
- executable program, which can also cause virtual memory paging, which
- can slow the whole program down and defeat the whole purpose of
- inlining. But using it just for your most critical speed sensitive
- functions could in some cases make your program run significantly
- faster, depending on just how speed sensitive those functions are.
-