|
|
Fredrik Eriksson <fe79}--at--{yahoo}--dot--{com> wrote:
> On Mon, 31 Mar 2008 22:58:31 +0200, Warp <war### [at] tagpovrayorg> wrote:
> > Stack allocation is actually pretty fast (at least with gcc in linux).
> That stack allocation is fast should come as no surprise since it
> typically requires a grand total of zero additional CPU instructions. In
> the worst case it requires a single one-cycle instruction.
But so does using a pre-allocated array. The array is *already* allocated.
The function doesn't need to allocate it each time. Yet, in some cases,
the function becomes faster by using the stack-allocated array than the
pre-allocated array in the heap.
--
- Warp
Post a reply to this message
|
|