comp.lang.ada
 help / color / mirror / Atom feed
From: Ray Blaak <blaak@infomatch.com>
Subject: Re: Stack based allocation vs. Dynamic allocation
Date: 2000/05/31
Date: 2000-05-31T00:00:00+00:00	[thread overview]
Message-ID: <m33dmz9otb.fsf@ns49.infomatch.bc.ca> (raw)
In-Reply-To: dale-D70BFC.16062031052000@news.rmit.edu.au

dale <dale@cs.rmit.edu.au> writes:
> A discussion at work left me claiming that stack based allocation
> was quicker than heap based allocation. 
> 
> A person wrote up a demonstration program that proved that this
> wasn't the case (at least for the experiment).
[...]
> procedure Stack is
>    N : constant := 500;
>    Big : constant := 1024 ** 2;
>    type ints is array (0 .. Big) of Integer;
[...]
> procedure Heap is
>    N : constant := 500;
>    Big : constant := 1024 ** 2;
>    type ints is array (0 .. N - 1) of integer;
>
> Does anyone know what the factors are that would cause stack
> allocation to be so slow?

Well the code you posted has the heap version working with much smaller arrays
(500 vs 1 million), so of course it will be faster. 

Fix the Heap version to have the same array type as in the Stack version and
try again. I am interested in the answer.

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
blaak@infomatch.com                            The Rhythm has my soul.




  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 ` Jean-Pierre Rosen
2000-05-31  0:00 ` Ray Blaak [this message]
2000-05-31  0:00   ` Gisle S�lensminde
2000-05-31  0:00     ` Aaro Koskinen
2000-05-31  0:00     ` Lutz Donnerhacke
2000-05-31  0:00       ` Gisle S�lensminde
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 ` Aaro Koskinen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox