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