in reply to Re: Diff between heap and stack
in thread Diff between heap and stack
well, really not, perl uses its own stack that is different from the C stack, that is used by the perl interpreter itself (because it's a C program!).
The stack is much faster (you have only one available element at the time) to access
this is not true either, in C allocating memory on the stack is much cheaper than in the heap but accessing it is roughly the same. In perl, as it uses its own memory pools to handle allocations, and actually any value is allocated on the heap (the stack only contains pointers) this doesn't apply and stack and heap are more or less equally fast.
|
|---|