From: aaro@iki.fi (Aaro Koskinen)
Subject: Re: Stack based allocation vs. Dynamic allocation
Date: 2000/05/31
Date: 2000-05-31T13:21:43+00:00 [thread overview]
Message-ID: <pdx1z2idfdk.fsf@vesuri.Helsinki.FI> (raw)
In-Reply-To: slrn8j9nsi.ab6.gisle@struts.ii.uib.no
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
gisle@struts.ii.uib.no (Gisle S�lensminde) writes:
> gisle@gekko:116> time heap
> Time: 0:53.92 real 31.250 user 12.190 sys 80.5%
>
> gisle@gekko:120> time stack
> Time: 0:11.02 real 10.490 user 0.030 sys 95.4%
>
> The stack program was 3 times faster if you consider user times.
> In my tests the system time used was always at least 11 seconds,
> while the stack program never used more than 0.05 seconds. The
> system have to work harder when using heap allocation, which makes
> the heap program run in only 1/4th of the time of the stack program.
The huge amount of used system time is interesting, since the
allocated data is always of the same size - there shouldn't be any
need for another system call after the first "new". Unless the "free"
releases the memory back to the operating system. (Most of C library
implementations I've seen do not usually shrunk the process' heap on
free()).
--
Aaro Koskinen, aaro@iki.fi, http://www.iki.fi/aaro
next prev parent reply other threads:[~2000-05-31 0:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-31 0:00 Stack based allocation vs. Dynamic allocation dale
2000-05-31 0:00 ` Aaro Koskinen
2000-05-31 0:00 ` Ray Blaak
2000-05-31 0:00 ` Dale Stanbrough
2000-05-31 0:00 ` Laurent Guerby
2000-06-01 0:00 ` Matthew Woodcraft
2000-06-01 0:00 ` Laurent Guerby
2000-06-05 0:00 ` Robert Dewar
2000-05-31 0:00 ` Gisle S�lensminde
2000-05-31 0:00 ` Lutz Donnerhacke
2000-05-31 0:00 ` Gisle S�lensminde
2000-05-31 0:00 ` Aaro Koskinen [this message]
2000-05-31 0:00 ` Jean-Pierre Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox