home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20162 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.7 KB

  1. Xref: sparky comp.lang.c:20162 comp.lang.c++:19853
  2. Newsgroups: comp.lang.c,comp.lang.c++
  3. Path: sparky!uunet!mole-end!mat
  4. From: mat@mole-end.matawan.nj.us
  5. Subject: Re: C/C++ Correctness (was: Re: C/C++ Speed)
  6. Message-ID: <1993Jan25.014332.14130@mole-end.matawan.nj.us>
  7. Summary: On space, speed, and inline
  8. Organization: :
  9. References: <1993Jan18.171841.3008@informix.com> <1jka6h$n32@agate.berkeley.edu> <1993Jan21.081537.8192@netcom.com>
  10. Date: Mon, 25 Jan 1993 01:43:32 GMT
  11. Lines: 25
  12.  
  13. In article <1993Jan21.081537.8192@netcom.com>, erc@netcom.com (Eric Smith) writes:
  14.  
  15. > Inlining can in fact make C++ faster than C, especially if it's the
  16. > only non-C feature you use in C++.  For many C programmers, inlining
  17. > alone is enough to justify the move to C++.
  18.  
  19. > The way to make inlining effective is to use it carefully, and only
  20. > inline the most critical speed sensitive functions.  If you inline
  21. > functions that don't really need it, you pay a penalty in size of your
  22. > executable program, which can also cause virtual memory paging, which
  23. > can slow the whole program down and defeat the whole purpose of
  24. > inlining.  ...
  25.  
  26. Remember though, that sufficiently small functions (e.g. members that
  27. set or return a single member variable, nonmembers like  operator+  on
  28. a type like  complex,  etc.) will be small enough on almost all machines
  29. that they will not make the code larger, will improve locality, avoid
  30. function call overhead, perhaps provide opportunities for local optimization
  31. where global would otherwise be necessary--and these are what inlines
  32. are most often used for.
  33. -- 
  34.  (This man's opinions are his own.)
  35.  From mole-end                Mark Terribile
  36.  
  37.  mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
  38.