home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11783 < prev    next >
Encoding:
Text File  |  1992-07-30  |  1.3 KB  |  30 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!gatech!rpi!usc!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!thompson
  3. From: thompson@atlas.socsci.umn.edu (T. Scott Thompson)
  4. Subject: Re: good memory allocation strategies?
  5. Message-ID: <thompson.712531797@daphne.socsci.umn.edu>
  6. Sender: news@news2.cis.umn.edu (Usenet News Administration)
  7. Nntp-Posting-Host: daphne.socsci.umn.edu
  8. Organization: University of Minnesota
  9. References: <1992Jul21.214115.28569@tamsun.tamu.edu>
  10. Date: Thu, 30 Jul 1992 21:29:57 GMT
  11. Lines: 17
  12.  
  13. tsmith@cs.tamu.edu (Todd M Smith) writes:
  14.  
  15. >2) How much of a speed penalty does dynamic allocation really impose?
  16.  
  17. This is clearly very sensitive to the specific application.  The speed
  18. penalty is ~100% on a do-nothing program that simply allocates and
  19. deallocates memory and 0% on a do-nothing program that does nothing at
  20. all.  A program that actually does something with the memory will get
  21. variable mileage, depending on what is done.
  22.  
  23. If you want an empirical example, a program that I ran recently on a
  24. Cray-2 dynamically allocated about 20K records building a fairly
  25. complicated geometrical data structure, did some simple processing of
  26. the structure, then deallocated everything.  I rewrote it to use
  27. static arrays instead and got about a 20% improvement in CPU time.
  28.  
  29.   -- Scott Thompson
  30.